答案 0 :(得分:4)
在 iOS 5 中,您可以使用一系列图片。首先,您需要添加一个新的类别方法:
@interface UIImage (WrightsCS)
+(UIImage*)animatedImageWithImages:(NSArray*)images duration:(NSTimeInterval)duration;
@end
+(UIImage*)loadingImage
{
NSArray *animationFrames = [NSArray arrayWithObjects:
[UIImage imageNamed:@"downloading01.png"],
[UIImage imageNamed:@"downloading02.png"],
[UIImage imageNamed:@"downloading03.png"],
[UIImage imageNamed:@"downloading04.png"],
[UIImage imageNamed:@"downloading05.png"],
[UIImage imageNamed:@"downloading06.png"],
[UIImage imageNamed:@"downloading07.png"],
[UIImage imageNamed:@"downloading08.png"],
[UIImage imageNamed:@"downloading09.png"],
[UIImage imageNamed:@"downloading10.png"],
[UIImage imageNamed:@"downloading11.png"],
[UIImage imageNamed:@"downloading12.png"],
[UIImage imageNamed:@"downloading13.png"],
[UIImage imageNamed:@"downloading14.png"],
[UIImage imageNamed:@"downloading15.png"],
[UIImage imageNamed:@"downloading16.png"],
nil];
return [UIImage animatedImageWithImages:animationFrames duration:1.0f];
}