UITableView iOS11 section HeaderFooterView 问题

今天跑了一下iOS 11下项目情况,碰到个坑,UITableView的显示问题,主要是
涉及到section HeaderFooter的代理方法不执行主要是高度,原因是tableView在iOS11默认使用Self-Sizing,estimatedSectionHeaderHeight,estimatedSectionFooterHeight默认值采用UITableViewAutomaticDimension导致。

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section;
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section;

处理方式1:

- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;  
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section;

处理方式2:

tableView.estimatedSectionHeaderHeight = 0;
tableView.estimatedSectionFooterHeight = 0;
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 一、简介 <<UITableView(或简单地说,表视图)的一个实例是用于显示和编辑分层列出的信息的一种手段 <<...
    无邪8阅读 10,716评论 3 3
  • 转载:http://blog.csdn.net/u013263917/article/details/728957...
    Jonath阅读 1,148评论 0 4
  • 转载请标注出处:www.jianshu.com/p/1167d2ecd0ac:,以及版权归属黑马程序员:http:...
    坤小阅读 3,702评论 4 24
  • 在1.8之前,如果我们想用第三方的库,只能获取到源码才可以,而不能使用编译后的代码,比如jar、dll、so文件。...
    UUID阅读 5,044评论 2 9
  • 我不知道在哪里看过的话,可能是飞赞还是什么的日记吧。 1.依稀记得是这样的:我躲在卧室里,蜷缩在床边,无边的黑暗向...
    00龙阅读 324评论 0 0