tags:

views:

163

answers:

1

Hi, I am trying to do a simple animation on the iPhone and then have it stop once it is finished. The code I am currently using is:

NSArray *imageArray = [[NSArray alloc] initWithObjects:
                           [UIImage imageNamed:@"init_lay1.png"],
                           [UIImage imageNamed:@"init_lay2.png"],
                           [UIImage imageNamed:@"init_lay3.png"],
                           [UIImage imageNamed:@"init_lay4.png"],
                           [UIImage imageNamed:@"init_lay5.png"],
                           [UIImage imageNamed:@"init_lay6.png"],
                           [UIImage imageNamed:@"init_lay7.png"],nil];

    imageViewArms.animationImages = imageArray;
    imageViewArms.animationDuration = 0.23;
    imageViewArms.contentMode = UIViewContentModeBottomLeft;
    imageViewArms.animationRepeatCount = 0.0;
    [imageViewArms startAnimating];

I'm not sure of how to stop it once it is finished. Any ideas? Thanks.

+1  A: 

-[UIImageView stopAnimating]?

Ben Gottlieb
I've tried that, but for some reason it doesn't even show the animation if I call [UIImageView stopanimatin];.
Phillip Whisenhunt
make sure you give the animation enough time to run; try using -performSelector:withObject:afterDelay: to stop it.
Ben Gottlieb