2

I use a UICollectionView with UICollectionViewFlowLayout. I change the height of a UICollectionViewCell if a user touches it. To achieve that I use performBatchUpdates:to animate the height change. This works perfectly and the change gets animated with a standard grow and shrink animation.

But I would like to change this standard animation. How would I do that? I can't seem to find any hint on how to influence the animation type used.

Stefan Arn
  • 1,156
  • 12
  • 29

1 Answers1

3

Thanks to the hint here https://stackoverflow.com/a/15068865/956433 it is possible to wrap the performBatchUpdates: into a UIView animation block. So to change the standard grow and shrink animation to a more fancy spring animation you could implement the following:

[UIView animateWithDuration:0.5
                      delay:0.0
     usingSpringWithDamping:0.5
      initialSpringVelocity:0.0
                    options:0
                 animations:^{
                     [collectionView performBatchUpdates:^{
                         // your changes to the data
                     } completion:nil];
                 } completion:nil];
Community
  • 1
  • 1
Stefan Arn
  • 1,156
  • 12
  • 29