2014-02-10 43 views
5

出于某种原因,我的UICollectionView在调用reloadData时为可见单元格内的过渡生成动画。在reloadData上禁用UICollectionView动画

从我的理解中不应该那样做,这就是我想要做的。

为什么集合视图会在重新加载数据上显示动画?我怎么能阻止它?

我将最终使用[UIView setAnimationsEnabled:YES/NO],但我会希望修复它,而不需要额外的代码。

+0

你是否在'performBatchUpdates:completion:'updates'块内调用'reloadData'?也许吧? – plu

+1

顺便说一句,如果你沿着'setAnimationsEnabled'道路走,我会去:'[UIView performWithoutAnimation:^ {}]' – plu

+0

@plu谢谢。不,不使用它里面'performBatch ...'另外,不能用'performWithoutAnimation'因为我们仍然瞄准的iOS 6.0('performWithoutAnimation'似乎并没有产生任何影响) – Andrei

回答

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