禁用 UICollectionView reloadData 时的动画效果

5

由于某些原因,当调用reloadData时,我的UICollectionView在可见单元格内部进行过渡动画。

据我所知,它不应该这样做,这就是我想要做的事情。

为什么集合视图会在重新加载数据时进行动画?我该如何停止它?

我最终将使用[UIView setAnimationsEnabled:YES/NO],但我希望能够不需要太多额外的代码来解决它。


你是否在 performBatchUpdates:completion:updates 块内调用了 reloadData 方法? - plu
1
顺便说一句,如果你选择使用 setAnimationsEnabled 方法,我会建议你使用 [UIView performWithoutAnimation:^{}] - plu
@plu 谢谢。不是在 performBatch... 内使用它。由于我们仍然针对 iOS 6.0,无法使用 performWithoutAnimation(似乎没有任何效果)。 - Alex
你解决了这个问题吗? - user3344977
你最终解决了这个问题吗? - peco
1个回答

7
[UIView performWithoutAnimation:^{
            [self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
        }];

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接