Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/112.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在表视图中实现搜索栏_Ios_Objective C_Uitableview_Uisearchbar - Fatal编程技术网

Ios 在表视图中实现搜索栏

Ios 在表视图中实现搜索栏,ios,objective-c,uitableview,uisearchbar,Ios,Objective C,Uitableview,Uisearchbar,此函数给出编译时错误 -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { [self filterContentForSearchText:searchString scope:[[self.searchDispla

此函数给出编译时错误

-(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]]];
弧语义问题

“ViewController”没有可见的@interface声明选择器 'filterContentForSearchText:作用域:'

如何删除此错误? 我遵循这个教程。教程中的确切函数是在xcode中给出错误

实现这一点

 - (void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope
    {
        NSPredicate *resultPredicate = [NSPredicate 
                                        predicateWithFormat:@"SELF contains[cd] %@",
                                        searchText];

        searchResults = [yourArray filteredArrayUsingPredicate:resultPredicate];
}

我已经实现了它。有问题的函数编码中的编译时错误。请参阅我正在遵循本教程。教程中的函数searchDisplayController在xcode中给出错误。问题发生的确切位置是哪一行…[self filterContentForSearchText:searchString作用域:[[self.searchDisplayController.searchBar ScopeButtonTiles]对象索引:[self.searchDisplayController.searchBar selectedScopeButtonIndex]];