此函数给出编译时错误
-(BOOL)searchDisplayController:(UISearchDisplayController *)controller
shouldReloadTableForSearchString:(NSString *)searchString
{
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles]
objectAtIndex:[self.searchDisplayController.searchBar
selectedScopeButtonIndex]]];
return YES;
}
此行的编译器错误
[self filterContentForSearchText:searchString
scope:[[self.searchDisplayController.searchBar scopeButtonTitles] objectAtIndex:[self.searchDisplayController.searchBar selectedScopeButtonIndex]]];
ARC语义问题
'ViewController'没有可见的@interface声明选择器 'filterContentForSearchText:范围:
如何删除此错误? 我正在关注本教程here。本教程中的确切功能是在xcode中给出错误。
答案 0 :(得分:0)
实施此
- (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
{
NSPredicate *resultPredicate = [NSPredicate
predicateWithFormat:@"SELF contains[cd] %@",
searchText];
searchResults = [yourArray filteredArrayUsingPredicate:resultPredicate];
}