tags:

views:

63

answers:

1

I know the 'nil' clears the imageView at the end of the animation. But is there a way to end it on one of the images? When I run it without 'nil' at the end it's a lovely error.

imageView.animationImages = [NSArray arrayWithObjects:
                                           [UIImage imageNamed:@"image1.png"],
                                           [UIImage imageNamed:@"image2.png"],
                                           [UIImage imageNamed:@"image3.png"],
                                           [UIImage imageNamed:@"image4.png"],
                                           [UIImage imageNamed:@"image5.png"],
                                           [UIImage imageNamed:@"image6.png"],
                                           [UIImage imageNamed:@"image7.png"],
                                           [UIImage imageNamed:@"image8.png"],
                                           [UIImage imageNamed:@"image9.png"],
                                           [UIImage imageNamed:@"image10.png"],
                                   [UIImage imageNamed:@"image0.png"],nil];
       imageView.animationDuration = 0.50;
       [imageView setAnimationRepeatCount: 1];
       [imageView startAnimating]; 
+1  A: 

I don't think there's a way to directly do this, but you could do something like:

//set your animationImages as stated in the question
[imageView setAnimationDuration:0.5];
[imageView setAnimationRepeatCount:1];
[imageView startAnimating];
[imageView performSelector:@selector(setImage:) withObject:theFinalImage afterDelay:[imageVIew animationDuration]];

Basically, you're going to run through the animations once, then replace the animation images with the final static image.

Dave DeLong
Thanks so much! I ended up using a different ImageView for the resulting image, but performselector was a huge boon! Thanks again!
Tru99