You can use the " UISearchController " as follows:
_searchController = [[UISearchController alloc] initWithSearchResultsController:self.resultsTableController]; self.searchController.searchResultsUpdater = self; [self.searchController.searchBar sizeToFit]; self.tableView.tableHeaderView = self.searchController.searchBar; // we want to be the delegate for our filtered table so didSelectRowAtIndexPath is called for both tables self.resultsTableController.tableView.delegate = self; self.searchController.delegate = self; self.searchController.dimsBackgroundDuringPresentation = NO; // default is YES self.searchController.searchBar.delegate = self; // so we can monitor text changes + others // Search is now just presenting a view controller. As such, normal view controller // presentation semantics apply. Namely that presentation will walk up the view controller // hierarchy until it finds the root view controller or one that defines a presentation context. // self.definesPresentationContext = YES; // know where you want UISearchController to be displayed
You can use this working Apple Reference Code Example for more details.
source share