Ala*_*lan 16 animation lazy-loading objective-c uitableview
我正在为我的UITableView进行延迟加载,所以我试图在图像更新时重新加载各行.然而,我遇到了一个奇怪的问题.
我打电话的时候
[self.bubbleTableView reloadRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:UITableViewRowAnimationNone];
Run Code Online (Sandbox Code Playgroud)
要么
[self.bubbleTableView reloadSections:[NSIndexSet indexSetWithIndex:[indexPath section]] withRowAnimation:UITableViewRowAnimationNone];
Run Code Online (Sandbox Code Playgroud)
当我特别说"无动画"时,它仍然会动画,动画就是图像占据整个单元格并迅速缩小到正常大小.此外,如果我将其更改为任何其他动画,无论在什么设置下它都会执行相同的动画.
如果我评论其中任何一个并且只是使用reloadData它工作正常,但我宁愿不做reloadData,因为性能原因是重新更新不需要更新的单元格.
谢谢!
ad1*_*ima 43
[UIView setAnimationsEnabled:NO];
[self.bubbleTableView reloadSections:[NSIndexSet indexSetWithIndex:[indexPath section]] withRowAnimation:UITableViewRowAnimationNone];
[UIView setAnimationsEnabled:YES];
Run Code Online (Sandbox Code Playgroud)
这个对我有用.
UPD.与@Şafak-gezer相同
[UIView performWithoutAnimation:^{
[self.bubbleTableView reloadSections:[NSIndexSet indexSetWithIndex:[indexPath section]] withRowAnimation:UITableViewRowAnimationNone];
}];
Run Code Online (Sandbox Code Playgroud)
迅速
UIView.performWithoutAnimation {
self.bubbleTableView.reloadSections(NSIndexSet(index: indexPath.section), withRowAnimation: UITableViewRowAnimation.None)
}
Run Code Online (Sandbox Code Playgroud)
以下方法对我有用:(适用于iOS 7及更高版本)
[UIView performWithoutAnimation:^{
[tableView reloadSections:[NSIndexSet indexSetWithIndex:[indexPath section]] withRowAnimation:UITableViewRowAnimationNone];
}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9925 次 |
| 最近记录: |