Note that there are some explanatory texts on larger screens.

plurals
  1. POMy animatewithduration, completion block is performed only once
    primarykey
    data
    text
    <p>I use the following block of code to slide a UIView down and when finished rotate another UIView. The second part of the animation, the completion block is only performed once which means the 1st animation is not completed else it would reach the completion block. On the iphone simulator it looks as if the 1st animation did finish... can anyone help me figure this out? my NSLog says:</p> <blockquote> <p>finished 1st</p> <p>started 2nd</p> <p>finished 1st</p> <p>finished 1st</p> <p>finished 1st<br> .<br> .<br> . </p> </blockquote> <pre><code>- (IBAction) move { [UIView animateWithDuration:0.7 animations:^{ [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.7]; [UIView setAnimationRepeatCount:1]; [UIView setAnimationRepeatAutoreverses:NO]; CGPoint pos = movingtTable.center; float moveDistance = 220.0; if(!isViewVisible){ //expose the view pos.y = pos.y+moveDistance; //disable selection for xy table xTable.userInteractionEnabled = NO; yTable.userInteractionEnabled = NO; //angle = M_PI; } else { pos.y = pos.y-moveDistance; xTable.userInteractionEnabled = YES; yTable.userInteractionEnabled = YES; //angle = -M_PI; } isViewVisible = !isViewVisible; movingtTable.center = pos; NSLog(@"finished 1st"); }completion:^(BOOL finished){ NSLog(@"started 2nd"); [UIView animateWithDuration:0.4 animations:^{ //[UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.4]; //[UIView setAnimationRepeatCount:1]; //[UIView setAnimationRepeatAutoreverses:NO]; arrows.transform = CGAffineTransformMakeRotation(angle); }completion:^(BOOL finished){ angle = -angle; }]; }]; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload