free
viewForHeaderInSection 与 heightForHeaderInSection
  • 首页 > 技术 > Objective-C
  • 作者:free
  • 2019年4月22日 14:45 星期一
  • 浏览:3142
  • 字号:
  • 评论:0
  • 经过项目中问题,测试发现:


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

    - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section



    UITableView的代理方法viewForHeaderInSectionheightForHeaderInSectioniOS11之前(不包含iOS11)需要成对实现,否则会导致sectionHeader加载不出来。



    iOS11之后,只需viewForHeaderInSection一个方法即可,系统会自动去取其中实现的view的宽高。



    但是为了防止遗漏系统适配,建议适配iOS9以后的项目还是两个都实现吧,如果项目只支持iOS11之后可以只实现一个方法

      您阅读这篇文章共花了:  
     本文无需标签!
    二维码加载中...
    本文作者:free      文章标题: viewForHeaderInSection 与 heightForHeaderInSection
    本文地址:https://renchuanchuan.com/?post=4
    版权声明:若无注明,本文皆为“RCC”原创,转载请保留文章出处。