美文网首页
iOS UITableView heightForHeaderI

iOS UITableView heightForHeaderI

作者: Accepted_ | 来源:发表于2018-07-26 18:21 被阅读0次

UITableView设置为Group样式。

不走heightForHeaderInSection/heightForFooterInSection方法。

对于没隐藏苹果原生的navigationBar的。

解决办法:

主题 : iOS11 heightForHeaderInSection设置高度无效

总结:

iOS11默认开启Self-Sizing,关闭Self-Sizing即可。

self.tableView.estimatedRowHeight = 0; 

self.tableView.estimatedSectionHeaderHeight = 0;

self.tableView.estimatedSectionFooterHeight = 0;

对于隐藏了苹果原生navigationBar,用UIView自己写navigationBar的。

可能是没有实现tableView: viewForHeaderInSection:/tableView: viewForFooterInSection:造成的。

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

        return 10;

}

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

        return [[UIView alloc] init];

} //viewForFooterInSection同理

相关文章

网友评论

      本文标题:iOS UITableView heightForHeaderI

      本文链接:https://www.haomeiwen.com/subject/wzabmftx.html