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