How to show animation of an image on iphone
3 answers
Here is the code I have in my current project. I have a loop to put standy2 images in standby7.png into an array. I am using imageWithContentsOfFile as it seems a little better when using memory.
standbyAnimationImages = [[NSMutableArray alloc] init];
for (NSUInteger i=2; i<=7; i++) {
filename = [NSString stringWithFormat:@"standby%d", i];
[standbyAnimationImages addObject:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:filename ofType:@"png"]]];
}
imageViewAnimation.animationImages = standbyAnimationImages;
imageViewAnimation.animationDuration = 2;
imageViewAnimation.animationRepeatCount = 0;
[imageViewAnimation startAnimating];
Hope this helps you.
+2
a source to share