NSArray *animationFrames = [NSArray arrayWithObjects:
[UIImage imageWithName:@"image1.png"],
[UIImage imageWithName:@"image2.png"],
nil];
UIImageView *animatedImageView = [[UIImageView alloc] init];
animatedImageView.animationImages = animationsFrame;
[animatedImageView startAnimating];
如果你的目标是iOS 5,你可以直接在UIImage
没有UIImageView
使用的情况下进行
+(UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration
例如,
[UIImage animatedImagesWithImages:animationFrames duration:10];