搜素總結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搜索