NSPredicate Search Keyboard Lag
- by user3306356
I'm experiencing some keyboard lag on my NSPredicate search:
some code:
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
NSPredicate *resultPredicate = [NSPredicate predicateWithFormat:@"(head beginswith[c] %@) OR (pro beginswith[c] %@) OR (searchableStringValue beginswith[c] %@)", searchText, searchText, searchText];
searchResults = [chengduhua filteredArrayUsingPredicate:resultPredicate];
}
&&&&
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}