NSMutableArray *imageArray=[[NSMutableArray alloc]initWithCapacity:0];
for(int i=1;i<18;i++)
{
NSString *imageName=[NSString stringWithFormat:@"campFired.gif",i];
UIImage *image=[UIImage imageNamed:imageName];
[imageArray addObject:image];
}
CGRect rect=CGRectMake(0, 0, 320, 460);
UIImageView *imageView=[[UIImageView alloc]initWithFrame:rect];
imageView.animationImages=imageArray;//指定图片数组
imageView.animationRepeatCount=0;//动画循环次数,0为无限
imageView.animationDuration=1;//间隔时间
[self.view addSubview:imageView];
[imageView release];
[imageView startAnimating];//动画开始