user187676
user187676

Reputation:

Reverse animation before it is finished

I have a button and when the user touches down and holds a popup appears. However, when the user releases his thumb before the pop animation finishes I'd like the animation to stop where it is and autoreverse to the initial position. How can I accomplish this?

Currently I'm simply using UIViews -animateWithDuration:animations:completion:. Do I have to set the animations explicitly in this case?

I've already tried reading the current state from the presentationLayer properties, but that somehow didn't work.

Upvotes: 2

Views: 229

Answers (1)

Rengers
Rengers

Reputation: 15228

You can start the second animation using the UIViewAnimationOptionBeginFromCurrentState option. This will stop the first animation if it's still running.

Upvotes: 1

Related Questions