搜素总结html
一、加的是searchDisplayController代理
二、两个代理 UISearchBarDelegate,UISearchDisplayDelegate 并设置code
三、连线 searchDisplay和searchBarorm
四、将 self.tableView.tableHeaderView=self.searchBar 固定住htm
五、搜索时调用的方法blog
#pragma mark 搜索方法 -(BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString{ NSPredicate * query=[NSPredicate predicateWithFormat:@"SELF.name contains[c]%@",searchString]; self.searchResult=[self.contacts filteredArrayUsingPredicate:query]; return YES; }
六、搜索的时候会显示本身的tableView 肯定是否是searchDisplay.searchResultsTableViewit
七、修改tableView counttable
八、跳转判断 查看联系人 class
参考资料http://www.cnblogs.com/lesliefang/p/3929677.html搜索