Search code examples
iphoneobjective-cxcodecore-animation

When and where should I use removeAllAnimations when using CATransition?


OK. I'm using CATransition to provide a custom animations for my navigation bar.

I'm using CATransition in my viewDidLoads to provide my pop animation and CATransition in button methods to push to the next view controller.

I've seen mention that removeAllAnimations should be used, but I'm not sure where or when. The documentation doesn't seem to help.

When and where should I use removeAllAnimations when using CATransition?


Solution

  • Animations are automatically removed upon completion unless you explicitly tell them to not be. You use removeAllAnimations when you want to do just that. One common use case is to cancel animations or if you have configured your animation to not be removed on completion and what to go back to the state before the animation.