Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let animating view stay at the current position when [layer removeAllAnimations] called

If there are two animations happens in sequence, I would like to remove the first animation, and start the second animation from the current position. I used [layer removeAllAnimations] to cancel the first animation before adding the second animation to the layer, the layer always goes back to the initial position. I know it's the default action of removeAllAnimations, but I would like to know if there's any way you can set the layer to stay the current position. Thank you very much.

Update -- I got this done by getting the presentationLayer position and assign it to the model layer position. And I also used - (void)animationDidStop:(UIAnimation*)animation finished:(BOOL)flag; to check if the animation finishes.

like image 759
Jason Avatar asked Apr 19 '12 17:04

Jason


1 Answers

You could use: myView.frame = [[myView.layer presentationLayer] frame]

like image 71
Edwin Vermeer Avatar answered Sep 29 '22 10:09

Edwin Vermeer