调用 tableview 的reloadData方法,在ios 13.3之前,如果tableview本身的contentOffset有值时,则scrollViewDidScroll方法会调用,13.3之后不会
ios 12以前,如果cell的高度是很大的情况,scrollViewDidScroll会先到该cell的前一个cell所在的偏移量,然后到该cell的后一个cell所在的偏移量,最后才是当前所有的偏移量
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);