I am starting an animation via a button press. Here is the code for the button:
-(IBAction)startAnimation:(id)sender{
stick.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"photo 1.JPG"],
[UIImage imageNamed:@"photo 2.JPG"],
[UIImage imageNamed:@"photo 3.JPG"],
[UIImage imageNamed:@"photo 4.JPG"],
[UIImage imageNamed:@"photo 5.JPG"],nil];
[stick setAnimationRepeatCount:200];
stick.animationDuration = 0.5;
[stick startAnimating];
}
and when the animation is done, i want to have a button appear, to play another animation on the screen. How can i test or see when my animation is done playing? Thanks in advance!
You haven’t told us what
stickis, but it looks like aUIImageView. You can only callisAnimatingto check whether the animation is still running but you don’t get any notification and there’s no delegate either. You can calculate the stop time (200 * 0.5) and thus set up a timer (add a little safety margin). This won’t be 100% correct but it might be “good enough”.