NSPredicate Search Keyboard Lag
Posted
by
user3306356
on Stack Overflow
See other posts from Stack Overflow
or by user3306356
Published on 2014-06-01T09:20:16Z
Indexed on
2014/06/01
9:25 UTC
Read the original article
Hit count: 165
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;
}
© Stack Overflow or respective owner