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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM