UICollectionView: Animate cell size change on selection
ios, swift, uicollectionview
Solution
[UIView transitionWithView:collectionView
duration:.5
options:UIViewAnimationOptionTransitionCurlUp
animations:^{
//any animatable attribute here.
cell.frame = CGRectMake(3, 14, 100, 100);
} completion:^(BOOL finished) {
//whatever you want to do upon completion
}];
Play around with something along those lines inside your `didselectItemAtIndexPath` method.
Problem
What I want to do is change the size of an UICollectionViewCell, and to animate that change, when the cell is selected. I already managed to do that unanimated by marking a cell as selected in `collectionView: didSelectItemAtIndexPath:` and then calling `reloadData` on my UICollectionView, displaying the selected cell with a different size. Nevertheless, this happens all at once, and I have no clue how to get that change in size animated. Any ideas? I already found Animate uicollectionview cells on selection, but the answer was to unspecific for me and I didn't figure out yet if it could also help me in my case.