简体   繁体   English

在reloadData上禁用UICollectionView动画

[英]Disable UICollectionView animation on reloadData

For some reason, my UICollectionView animates the transition inside the visible cell when calling reloadData . 出于某种原因,我的UICollectionView在调用reloadData时对可见单元内的过渡UICollectionView动画效果。

From what I understood it shouldn't do that, and that's what I am trying to do. 据我了解,它不应该这样做,而这就是我正在尝试做的事情。

Why would the collection view animate on reload data? 为什么集合视图会在重新加载数据上设置动画? And how could I stop it? 我怎么能阻止它?

I will be eventually using [UIView setAnimationsEnabled:YES/NO] , but I would be hoping to fix it without too much extra code. 我最终将使用[UIView setAnimationsEnabled:YES/NO] ,但我希望在没有太多额外代码的情况下进行修复。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM