最近在给 UITableView 添加下拉刷新的时候,发现 setContentOffset:animated:在 iOS11 iOS12 失效。不会使用动画,而是很突兀的恢复了偏移。最后发现了解决办法:
_tableView.estimatedRowHeight = 0;// default is UITableViewAutomaticDimension, set to 0 to disable
_tableView.estimatedSectionHeaderHeight =0;// default is UITableViewAutomaticDimension, set to 0 to disable
_tableView.estimatedSectionFooterHeight =0; // default is UITableViewAutomaticDimension, set to 0 to disable
在给UITableView添加下拉刷新时,iOS11与iOS12中setContentOffset:animated:方法会导致动画失效,偏移恢复突兀。解决办法为将tableView的estimatedRowHeight, estimatedSectionHeaderHeight及estimatedSectionFooterHeight设置为0。
375

被折叠的 条评论
为什么被折叠?



