UISearchBar 和 UISearchDisplayController 没有在UITableView 的headerView 导致searchResultsTableView的frame出问题
来源:互联网 发布:nec投影机网络投影 编辑:程序博客网 时间:2024/06/06 01:19
由于设计需求 UISearchBar 和 UISearchDisplayController 没有在UITableView 的headerView 导致searchResultsTableView的frame 出问题。
-(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(resSetFrame:) name:UIKeyboardWillHideNotification object:nil];}- (void)resSetFrame:(NSNotification*)notification{ CGFloat height = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue].size.height; UITableView *tableView = [[self searchDisplayController] searchResultsTableView]; UIEdgeInsets inset; //49 我加上 49 是因为 还有tabbar 在显示 没有隐藏 [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? (inset = UIEdgeInsetsMake(0, 0, height + 49, 0)) : (inset = UIEdgeInsetsZero); [tableView setContentInset:inset]; [tableView setScrollIndicatorInsets:inset];}
------------分割线-----------------
附带 更改 cancel 变更为 “取消”
-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar{ your_searchBar.showsCancelButton = YES; self.navigationController.navigationBar.hidden = YES; //将 cancel 改成 取消 并且显示白色 for(id item in [searchBar.subviews[0] subviews]) { NSLog(@"%@",item); if([item isKindOfClass:[UIButton class]]) { UIButton *btn = (UIButton *)item; [btn setTitle:@"取消" forState:UIControlStateNormal]; btn.tintColor = [UIColor whiteColor]; [btn setNeedsDisplay]; } }}
0 0
- UISearchBar 和 UISearchDisplayController 没有在UITableView 的headerView 导致searchResultsTableView的frame出问题
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar 和 UISearchDisplayController的使用
- UISearchBar UISearchDisplayController searchResultsTableView contentSize 问题
- UISearchDisplayController's searchResultsTableView在IOS7下的一个bug
- 在点击UISearchBar时,显示一个默认的searchResultsTableView
- UISearchDisplayController 与 UISearchBar 在IOS7的问题
- 最短路径__Candies ( Poj )
- MySQL索引背后的数据结构及算法原理
- 函数的原型。。。原型链
- 十月英语
- 【FastDev4Android框架开发】AndroidAnnnotations注入框架使用之第三方框架集成RoboGuice(十三)
- UISearchBar 和 UISearchDisplayController 没有在UITableView 的headerView 导致searchResultsTableView的frame出问题
- 泛型学习笔记
- 最短路径__Subway( Poj 2502 )
- org.springframework.dao.support.DaoSupport 错误
- 我们来学习下用X_util框架来解析网络json文件,然后进行添加操作
- URL在线转义
- Android下拉刷新的ListView制作
- COGS182. [USACO Jan07] 均衡队形
- 简单的计算器程序 c++