6

Say I do this:

[self.collectionView setCollectionViewLayout:myNewLayout animated:YES];

What is the duration of the animation that happens?

My application of this is that I'm animating layer properties inside the cells when this changes, and because layer animations don't get caught by UIView's block-based animations, I have to do it separately with my own animation block.

Tom Hamming
  • 10,577
  • 11
  • 71
  • 145

2 Answers2

22

It you know you're inside a UIView animation, then [CATransaction animationDuration] will give you what you need.

Nicolas B.
  • 1,318
  • 1
  • 11
  • 20
0

Swift

Use this: CATransaction.animationDuration()

- Note:

You may need to check out and apply the timing curve too. Because it affects how the animation looks Use this if so: CATransaction.animationTimingFunction()

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278