NSMutableArray *mutArray=[[NSMutableArray alloc]init];
for(int i=1;i<13;i++)
{
//创建图片名称
NSString *imgName=[[NSString alloc]initWithFormat:@"player%i.png",i];
UIImage *image=[UIImage imageNamed:imgName];
//将图片对象添加到数组
[mutArray addObject:image];
}
//创建图片控件对象
UIImageView *imgView=[[UIImageView alloc]initWithFrame:CGRectMake(0,20,50,50)];
imgView.backgroundColor=[UIColor redColor];
[self.window addSubview:imgView];
imgView.animationImages=mutArray;//执行动画的图片
imgView.animationDuration=1;//执行动画的时间
[imgView startAnimating];//开始动画