小编Tun*_*Dev的帖子

搜索显示控制器在iOS8中已弃用

我在尝试运行代码时收到上述警告消息.

NSDictionary *tempDictionary = nil;

    if (self.tableView == self.searchDisplayController.searchResultsTableView) {
        tempDictionary = [filteredCompanyArray objectAtIndex:indexPath.row];
    }
    else {
        tempDictionary= [self.client_list objectAtIndex:indexPath.row];
    }
Run Code Online (Sandbox Code Playgroud)

它已被弃用并进行谷歌搜索,但我看到的只是Swift的教程.

我在这里按照Ray Wenderlich教程http://www.raywenderlich.com/16873/how-to-add-search-into-a-table-view但现在我卡住了.

#pragma mark Content Filtering
-(void)filterContentForSearchText:(NSString*)searchText scope:(NSString*)scope {
    // Update the filtered array based on the search text and scope.
    // Remove all objects from the filtered search array
    [self.filteredCompanyArray removeAllObjects];
    // Filter the array using NSPredicate
    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF.name contains[c] %@",searchText];
    filteredCompanyArray = [NSMutableArray arrayWithArray:[self.client_list filteredArrayUsingPredicate:predicate]];
}

#pragma mark - UISearchDisplayController Delegate …
Run Code Online (Sandbox Code Playgroud)

objective-c uisearchdisplaycontroller ios

5
推荐指数
2
解决办法
1万
查看次数