iOS开发——heightForHeaderInSection设置高度无效
2018-01-24 14:47
1191 查看
iOS11之后,tableView设置section高度失效,解决方法有两种:
1、iOS11默认开启Self-Sizing,关闭Self-Sizing即可。在初始化tableview的地方加上下面的设置,即可。
self.tableView.estimatedRowHeight = 0;
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.estimatedSectionFooterHeight = 0;
2、如果- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;这个方法有用到的话,也可以正常显示section的高度;如果原项目没有用到它,也可以随便针对某一个section里面搞一个view扔进去也行。
换句话说,就是- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;这个方法里面有东西,就不影响tableView设置section高度。
1、iOS11默认开启Self-Sizing,关闭Self-Sizing即可。在初始化tableview的地方加上下面的设置,即可。
self.tableView.estimatedRowHeight = 0;
self.tableView.estimatedSectionHeaderHeight = 0;
self.tableView.estimatedSectionFooterHeight = 0;
2、如果- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;这个方法有用到的话,也可以正常显示section的高度;如果原项目没有用到它,也可以随便针对某一个section里面搞一个view扔进去也行。
换句话说,就是- (UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;这个方法里面有东西,就不影响tableView设置section高度。
相关文章推荐
- ios开发之--ios11适配:TableView的heightForHeaderInSection设置高度无效/UISearchBar消失
- 【iOS开发】关于Xcode8后产生的viewForHeaderInSection、viewForFooterInSection设置不产生效果的问题
- iOS开发:Xcode 7之后viewForHeaderInSection、viewForFooterInSection设置内容不产生效果的解决方法
- 如何设置不同组section的的头部高度?tableView heightForHeaderInSection
- iOS开发-设置headerInsectionView不悬浮
- ios:改变tableview的titleForHeaderInSection字体颜色设置
- iOS开发-设置headerInsectionView不悬浮
- iOS开发UI— QQ好友列表(处理头部控件的点击)viewForHeaderInSection:
- 【iOS】tableView:viewForHeaderInSection: 方法未调用
- UITableView heightForHeaderInSection遇到的坑
- 简单代码设置titleForHeaderInSection
- iOS tableview viewForHeaderInSection 自定义
- Xcode9 iOS11适配 iPhoneX适配 heightForHeaderInSection、contentInset失效解决 contentInsetAdjustmentBehavior详解
- 设置titleForHeaderInSection
- Xcode9 iOS11适配 iPhoneX适配 heightForHeaderInSection、contentInset失效解决 contentInsetAdjustmentBehavior详解
- iOS开发 TableView的headerInSectionView 不悬浮
- iOS开发中屏幕旋转至一个方向后再手动设置屏幕旋转至该方向无效问题
- iOS开发--改变tableHeaderView的高度
- 【iOS开发-103】解决方案:iOS8.1中UIBarButtonItem的setTitleTextAttributes对Disabled颜色设置无效
- [iOS开发]Xcode5如何设置ARC有效/无效