I have created a UITableViewViewController with a UISearchDisplayController. When i search in the searchbar the values will show in en extra tableview.
I set both background on clearColor, therefore I can see that both tableviews have data.
How can i handle that there will be shown only the searched data when using the searchbar and after that the normal data will show?
That's the methods I use for the UISearchDisplayController:
- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
self.filteredList = [SearchHelper getSearchedItemsAsArray:[self.arrayWithCompanies mutableCopy] searchWord:searchString scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
return YES;
}
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption
{
[SearchHelper getSearchedItemsAsArray:[self.arrayWithCompanies mutableCopy] searchWord:self.searchDisplayController.searchBar.text scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:searchOption]];
return YES;
}
Thanks for help and tips