ios基础开发 搜索功能总结
发布日期:2021-08-28 19:37:21 浏览次数:3 分类:技术文章

本文共 715 字,大约阅读时间需要 2 分钟。

hot3.png

搜素总结

1、加的是searchDisplayController

2、两个代理  UISearchBarDelegate,UISearchDisplayDelegate 并设置

3、连线 searchDisplay和searchBar

4、将 self.tableView.tableHeaderView=self.searchBar 固定住

5、搜索时调用的方法

#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;}

6、搜索的时候会显示自己的tableView  确定是不是searchDisplay.searchResultsTableView

7、修改tableView  count

8、跳转判断 查看联系人 

参考资料http://www.cnblogs.com/lesliefang/p/3929677.html

转载于:https://my.oschina.net/u/554046/blog/519762

转载地址:https://blog.csdn.net/weixin_33969116/article/details/92002174 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:A标签中通过href和onclick传递的this对象
下一篇:php 常用的设计模式

发表评论

最新留言

哈哈,博客排版真的漂亮呢~
[***.90.31.176]2024年04月01日 03时51分42秒