How can I hide an image after the end of the animation images?

advertisements
    Monster1Hit = YES;
    Monster1.animationImages = [NSArray arrayWithObjects:
                                [UIImage imageNamed:@"Explode1.png"],
                                [UIImage imageNamed:@"Explode2.png"],
                                [UIImage imageNamed:@"Explode3.png"],
                                [UIImage imageNamed:@"Explode4.png"],
                                [UIImage imageNamed:@"Explode5.png"],
                                [UIImage imageNamed:@"Explode7.png"],
                                [UIImage imageNamed:@"Explode8.png"],
                                [UIImage imageNamed:@"Explode9.png"],
                                [UIImage imageNamed:@"Explode10.png"],
                                [UIImage imageNamed:@"Explode11.png"],
                                [UIImage imageNamed:@"Explode12.png"],
                                [UIImage imageNamed:@"Explode13.png"], nil];
    [Monster1 setAnimationRepeatCount:1];
    Monster1.animationDuration = 1;
    [Monster1 startAnimating];

I want the image to be hidden after the animation is complete to make it look like an explosion and the picture disappears.


If you want to do any work you can call function after your animation duration like below

[self performSelector:@selector(animationDidFinish:) withObject:nil
    afterDelay:Monster1.animationDuration]; //Do whataver you want to do in animationDidFinish: and start animation again if you want