iOS11 调整tableview 头部空白高度关闭自动调整
2017-09-26 10:29
483 查看
每个tableview需要设置headerView和footer为空,和调整高度即可
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { if (section == 0) { return 0.01; }else{ return 20; } } - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { return 0.01; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ return nil; } //有时候tableview的底部视图也会出现此现象对应的修改就好了 - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{ return nil; }
如果这样做了之后你会发现ios11会动态挑战 header 部分的高度.....,解决方法如下
if (@available(iOS 11.0, *)) { self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; } else { self.automaticallyAdjustsScrollViewInsets = NO; }
相关文章推荐
- tableView Header view 自动调整高度
- iOS 8 Tableview根据AutoLayout自动调整高度
- tableviewcell 自动调整textfiled的键盘遮挡问题 UITableViewController中的tableview做可以自适应键盘高度来改变tableview的额外高度。
- Swift - 去除tableView在编辑模式下的自动缩进(单元格头部不留空白)
- iOS 8 Tableview根据AutoLayout自动调整高度,iostableview高度
- 关于iOS TableView旋转后头部空白的问题
- ios tableview 自动计算cell高度
- IOS11以后,如何调整UITableView的section的高度
- tableView尾部多处一部分空白高度
- iOS11 Tableview顶部空白和Section Header留白问题
- UITableView tableFooterView autolayout自动计算高度
- [转]让UITableView中的单元格根据内容的多少自动调整高度
- UITableView详解(UITableViewCell(三) cell根据文本长度来自动调整cell高度)
- IOS TableView的Cell高度自适应,UILabel自动换行适应(转载)
- 如何设置不同组section的的头部高度?tableView heightForHeaderInSection
- IOS TableView的Cell高度自适应,UILabel自动换行适应
- IOS TableView的Cell高度自适应,UILabel自动换行适应
- IOS TableView的Cell高度自适应,UILabel自动换行适应
- IOS TableView的Cell高度自适应,UILabel自动换行适应
- 如何解决tableview上面有一个小空白的区域,关掉自动布局就可以了