美文网首页iOS 学习
iOS UITableView视图上方出现空白

iOS UITableView视图上方出现空白

作者: 零粹 | 来源:发表于2018-04-08 19:56 被阅读9次

iOS UITableView视图上方出现空白


iOS 11中如果不实现-tableView: viewForFooterInSection: 和 -tableView: viewForHeaderInSection:,那么-tableView: heightForHeaderInSection:和- tableView: heightForFooterInSection:不会被调用。

这是因为estimatedRowHeight estimatedSectionHeaderHeight estimatedSectionFooterHeight三个高度估算属性由默认的0变成了UITableViewAutomaticDimension,导致高度计算不对,解决方法是实现对应方法或吧这三个属性设为0。

self.tableView.estimatedRowHeight = 0;

self.tableView.estimatedSectionHeaderHeight = 0;

self.tableView.estimatedSectionFooterHeight = 0;

相关文章

网友评论

    本文标题:iOS UITableView视图上方出现空白

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