UITableView只更新高度不更新内容,不想要跳动动画

2020-07-24  本文已影响0人  唐tttyyy

UITableView只更新高度不更新内容,不想要跳动动画的办法整理记录。

如果用reload的方法会刷cell的的构造方法。

记录下如下用法:

[self.mainTableView beginUpdates];
XXXTableViewCell *cell = [self.mainTableView cellForRowAtIndexPath:indexpath];
[cell bindWithModel:model];
[self.mainTableView endUpdates];

如果还是有动画:
那试试下面的方法

[UIView setAnimationsEnabled:NO];
[UIView performWithoutAnimation:^{
    [self.mainTableView beginUpdates];
    XXXTableViewCell *cell = [self.mainTableView cellForRowAtIndexPath:indexpath];
   [cell bindWithModel:model];
    [self.mainTableView endUpdates];
}];
[UIView setAnimationsEnabled:YES];
上一篇 下一篇

猜你喜欢

热点阅读