viewForHeaderInSection 与 heightForHeaderInSection

经过项目中问题,测试发现:
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
UITableView的代理方法viewForHeaderInSection与heightForHeaderInSection在iOS11之前(不包含iOS11)需要成对实现,否则会导致sectionHeader加载不出来。
iOS11之后,只需viewForHeaderInSection一个方法即可,系统会自动去取其中实现的view的宽高。
但是为了防止遗漏系统适配,建议适配iOS9以后的项目还是两个都实现吧,如果项目只支持iOS11之后,可以只实现一个方法。


本文无需标签!
本文作者:free
文章标题: viewForHeaderInSection 与 heightForHeaderInSection
本文地址:https://renchuanchuan.com/?post=4
版权声明:若无注明,本文皆为“RCC”原创,转载请保留文章出处。
本文地址:https://renchuanchuan.com/?post=4
版权声明:若无注明,本文皆为“RCC”原创,转载请保留文章出处。

