You can configure the data source for tableView so that it returns 0 sections when the search interface is visible:
- (NSInteger) numberOfSectionsInTableView: (UITableView *) tableView { if (self.searchDisplayController.active && (tableView != self.searchDisplayController.searchResultsTableview)) return 0; // return 0 for bottom table view if search interface is active else return <your usual number of sections> }
And instead of hiding your table view, you can do [tableView reloadData] to hide all content. Then, after the search is complete, reload the table view to display the contents again.
Rebooting the table view will reset all the cells in the table view and offset the contents of the table view, so in some cases this may not be very useful.
Alternatively, you can try to iterate through all the visible cells in the table and hide them as follows:
for (UITableViewCell *cell in tableView.visibleCells) { cell.hidden = YES; }
source share