For some reason, my UICollectionView
animates the transition inside the visible cell when calling reloadData
.
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.
var delegate: UICollectionViewDelegate? Reloads all of the data for the collection view. Call this method sparingly when you need to reload all of the items in the collection view. This causes the collection view to discard any currently visible items (including placeholders) and recreate items based on the current state of the data source object.
INSERTING AND REMOVING ITEMS UICollectionView provides several methods for explicitly animating position and content updates to cells in the collection, rather than simply calling reloadData and having it instantly change.
For efficiency, the collection view only displays those cells and supplementary views that are visible. If the collection data shrinks as a result of the reload, the collection view adjusts its scrolling offsets accordingly. You shouldn’t call this method in the middle of animation blocks where items are being inserted or deleted.
UICollectionView is a subclass of UIScrollView and, as such, it can support virtually infinite scrollable content.
[UIView performWithoutAnimation:^{
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndex:0]];
}];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With