UIView animateWithDuration await animation end

I start the animation after clicking the button. If the user touches the button before the end of the current animation, I want the new animation to wait until the end of the current animation. How can i do this?

+4
source share
2 answers

Paste it with a change in the completeness of the UIView animateWithDuration shell as follows:

[UIView animateWithDuration:1.00 animations:^{ //animate first! } completion:^(BOOL finished) { [UIView animateWithDuration:1.00 animations:^{ //animate the second time. }]; }]; 

Or just set one animation to continue from the current state with this:

 [UIView animateWithDuration:1.00 delay:0.00 options:UIViewAnimationOptionBeginFromCurrentState animations:^{ //animate } completion:^(BOOL finished){ }]; 
+10
source

I always associate my animation with this:

 [self performSelector:@selector(animationDone) withObject:nil afterDelay:1.0]; 
0
source

Source: https://habr.com/ru/post/1399604/


All Articles