首页 > 在使用reloadSection这个方法的时候发生contentoffset变化的问题

在使用reloadSection这个方法的时候发生contentoffset变化的问题

在UI上有一个是action之后需要刷新tableview section的过程,我使用了下面这个方法:
整个tableview的高度使用了UITableViewAutomaticDimension和estimatedRowHeight,

- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation NS_AVAILABLE_IOS(3_0);

但是使用之后,tableview的contentoffset会发生变化,也就是说,整个tableview会向上滑动一下,暂时还理不出问题的头绪,不知道有没有哪位遇到过这种bug,希望能解答一下。


1.可以尝试使用reload
2.可以尝试下提前记录offSet

GPoint offset = tableView.contentOffset;
- (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; //用UITableViewRowAnimationNone
[tableView layoutIfNeeded]; // 强制更新
[tableView setContentOffset:offset];
【热门文章】
【热门文章】