首先设置一个搜索button用以触发搜索
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(searchBarButtonItemAction:)];
接下来到方法中进行
- (void)searchBarButtonItemAction:(UIButton *)sender {
self.tableViewVC = [[UITableViewController alloc] initWithStyle:UITableViewStylePlain];
self.tableViewVC.tableView.frame = CGRectMake(0, 0, kWidth, kHeight - 49 - 64);
_tableViewVC.tableView.tableFooterView =[[UIView alloc] initWithFrame:CGRectZero];