iOS TableView reloadData刷新列表cell亂跳、tableview閃動的問題。


解決方法:

在iOS 11Self-Sizing自動打開后,contentSize和contentOffset都可能發生改變。可以通過以下方式禁用

 self.estimatedRowHeight = 0;
self.estimatedSectionHeaderHeight = 0;

self.estimatedSectionFooterHeight = 0;

 

在iOS 10 以下 通過以下協議方法設置精准高度就可以了

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(7_0);

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForHeaderInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);

- (CGFloat)tableView:(UITableView *)tableView estimatedHeightForFooterInSection:(NSInteger)section NS_AVAILABLE_IOS(7_0);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM