I'm having a UISearchbar in my navigationbar. When I search something the delegate:
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString {
NSLog(@"Should reload");
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}
is called so It should reload my tableview. But it doesn't. I've got two results in my search array so that's not the problem.
My init in my UITableviewController is like this:
_searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
_searchBar.delegate = self;
_searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:_searchBar contentsController:self];
_searchDisplayController.delegate = self;
_searchDisplayController.searchResultsDataSource = self;
_searchDisplayController.searchResultsTableView.delegate = self;
After I alloc init my UITableviewController I do this:
_poiTableView = [[POITableViewController alloc] init];
self.navigationItem.titleView = _poiTableView.searchBar;
so the searchbar is in my navigationbar and it calls searchdislaycontroller the only thing is that it doesn't reload my tableview. Before I moved the searchbar to the navigationbar, it was in the headercell of the tableview. Then it reloaded my tableview. I only moved the searchbar tot the navigationbar.
POITableViewController
entirely in code? – andrewbuilder