Setting the contentOffset of a UICollectionView during update
Setting the contentOffset of a UICollectionView during update
- Subject: Setting the contentOffset of a UICollectionView during update
- From: Colas B <email@hidden>
- Date: Sun, 18 Oct 2015 17:26:07 +0000 (UTC)
I have a collection view, with a custom layout, whose layout is changing when one taps on a cell: the cell becomes bigger. The layout is not a sublass of UIViewCollectionViewFlowLayout but directly of UICollectionViewLayout.
I update the layout with [self.collectionView performBatchUpdates: ^{[self.tableView reloadItemsAtIndexPaths:indexPathsToUpdate];} completion:nil]; (I do implement the methods finalLayoutAttributesForDisappearingItemAtIndexPath: etc.)
The problem is that after the update, the contentOffset is not good anymore: I want the specific cell to be centered, but after the update it is not centered.
I tried to change the offset in the method finalizeCollectionViewUpdates: of my custom layout.I also tried to implement the method - targetContentOffsetForProposedContentOffset:
But the problem is always the same. During the animation, the cells that were not visible and become visible don't appear. They stay as "blank space" and only at the end of the animation they appear, all of a sudden.
So my question is, how to change the contentOffset of a UICollectionView during layout updates?
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden