TableView reloadData后contentSize不准确

原因 UITableView 的 Self-Sizing。及自动计算属性

在iOS11之前Self-Sizing默认是关闭的而在之后默认使用Self-Sizing.

为了性能,使用estimated而不是准确的的值来确定contentsize。因此在estimatedRowHeight, estimatedSectionHeaderHeight,estimatedSectionFooterHeight由0变为了UITableViewAutomaticDimension高度后,contentSize 出现了偏差。

解决方案 设置 estimatedRowHeight, estimatedSectionHeaderHeight, estimatedSectionFooterHeight 为0.

使用Runtime全局替换方案:

https://blog.csdn.net/Nathan1987_/article/details/78432585

猜你喜欢

转载自www.cnblogs.com/jisa/p/10943680.html
今日推荐