标签:
一,效果图。
二,代码。
RootViewController.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
//显示图片的UIImageView
UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 200, 200)];
imageview.backgroundColor=[UIColor redColor];
[self.view addSubview:imageview];
//动画的实现
NSMutableArray * images = [NSMutableArray arrayWithCapacity:6];
for (int i = 1; i <= 6; i++)
{
NSString * imageName = [NSString stringWithFormat:@"%d.jpg",i];
UIImage * image = [UIImage imageNamed:imageName];
[images addObject:image];
}
imageview.animationImages = images;
imageview.animationDuration = 0.3;
[imageview startAnimating];
}
标签:
原文地址:http://www.cnblogs.com/yang-guang-girl/p/5411177.html