#PRagma mark - 搜索栏代理方法- (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString{ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name CONTAINS[c] %@", searchString]; if (searchResultList) [searchResultList removeAllObjects]; searchResultList = [NSMutableArray arrayWithArray:[personList filteredArrayUsingPredicate:predicate]]; return true;}
用谓词取得匹配的搜索结果列表,清空搜索记录,展现搜索结果
新闻热点
疑难解答