Reputation: 2519
I'm using a UICollectionView
to display a set of graphics on several rows and columns. User can use pinchGesture
to zoom in / zoom out.
When user zoom in the graph size increases and user zoom out the graph size decreases. To change the size of graph I'm just changing the property itemSize
from UICollectionViewFlowLayout
. It works great but I'm unable to animate the change with the following code:
[UIView transitionWithView:self.theCollectionView
duration:0.5f
options:UIViewAnimationOptionCurveLinear
animations:^() {
_theFlowLayout.itemSize = cellSize;
}
completion:nil];
Any idea how to animate this change?
Regards,
Sébastien.
Upvotes: 2
Views: 964
Reputation: 119242
You can use the collection view's performBatchUpdates
method which will invalidate and re-query your layout, animating to any new values.
Something like this:
_theFlowLayout.itemSize = cellSize;
[self.theCollectionView performBatchUpdates:nil completion:nil];
You don't get to control the timing or curve of the animation, unfortunately.
Upvotes: 2