关于UISearchDisplayController的一个坑
来源:互联网 发布:岳游网络千炮捕鱼ol1.1 编辑:程序博客网 时间:2024/05/16 02:11
在使用UISearchDisplayController的时候,会发现输入文字搜索列出结果时, UISearchDisplayController的tableView的Frame会发生变化 导致显示不正确. 在VC中添加一下代码可以解决
- (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];}- (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];}- (void) keyboardWillHide:(NSNotification *)aNotification { NSDictionary* info = [aNotification userInfo]; CGSize kbSize = [[info objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size; UITableView *tableView = [self.searchDisplayController searchResultsTableView]; [tableView setContentInset:UIEdgeInsetsMake(0, 0, kbSize.height, 0)]; [tableView setScrollIndicatorInsets:UIEdgeInsetsMake(0, 0, kbSize.height, 0)];}
在显示结果的时候重置一下UISearchDisplayController里tableView 的frame
0 0
- 关于UISearchDisplayController的一个坑
- 关于UISearchDisplayController的一些使用经验分享
- 关于UISearchDisplayController的一些使用经验分享
- UISearchDisplayController's searchResultsTableView在IOS7下的一个bug
- 关于UISearchDisplayController和 uisearchBar使用时遇到的问题
- UISearchDisplayController 的使用
- UISearchDisplayController 的使用
- UISearchDisplayController 的使用
- UISearchDisplayController 的使用
- UISearchDisplayController的见解
- UISearchDisplayController 的使用
- UISearchDisplayController
- UISearchDisplayController
- UISearchDisplayController
- iOS一个容易上手的搜索框,包括模糊查询UISearchDisplayController和UISearchBar交互
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- ios 给xcode工程关联pod
- 为什么机器学习中, 要假设我们的数据是独立同分布的
- graham求凸包——poj1133Wall
- 1012. 数字分类 (20)
- 在TX1上安装RPLidar及其驱动
- 关于UISearchDisplayController的一个坑
- jdk、jre及jvm的关系
- C++ Primer Chapter 5
- 记录学习《0Day安全》路上遇到的问题解决方案 -- 开发shellcode的艺术!
- docker基础镜像制作
- Quartz Cron表达式
- Laplace近似后验概率
- 个人学习留笔
- 最简单的yii2安装教程