How to cancel UIView block-based animation?

You can stop all animations on a view by calling:

[view.layer removeAllAnimations];

(You’ll need to import the QuartzCore framework to call methods on view.layer).

If you want to stop a specific animation, not all animations, your best best bet is to use CAAnimations explicitly rather than the UIView animation helper methods, then you will have more granular control and can stop animations explicitly by name.

The Apple Core Animation documentation can be found here:

https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html

Leave a Comment