flavianatill
flavianatill

Reputation: 484

How to cancel UIView animation and skip to the end?

I would like to cancel a running UIView block animation and skip to the end of it.

I am aware that starting a new animation with the option UIViewAnimationOptionBeginFromCurrentState stops the previous animation, but instead of beginning from the current state, I would like to begin from the "final state" of the previous animation.

Is there a way to do that?

Upvotes: 1

Views: 937

Answers (1)

Duncan C
Duncan C

Reputation: 131503

If you send a removeAllAnimations message to the view's layer it should remove the currently active animations. Further, because the system sets the view properties to their final values as part of the animation, the view should jump to it's final position without you're having to do anything else.

Upvotes: 2

Related Questions