I'm trying to add an UISearchBar
to a table view I have defined in a ´nib´ file. I added a Search Bar and Search Display Controller in IB, linked the search bar outlet, and added this to the view controller's '.h' file:
@interface SearchListViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchDisplayDelegate>
Also, I've implemented the following delegate methods:
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString scope:
[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
return YES;
}
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
{
[self filterContentForSearchText:self.searchDisplayController.searchBar.text scope:
[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:searchOption]];
return YES;
}
I find that shouldReloadTableForSearchString:
method is called, but however shouldReloadTableForSearchScope:
method is never called, so my table view data is not reloaded with search results... what could I be missing?
Thanks in advance