UIImageView *imgView = [[UIImageView alloc]init];
[self.window addSubview:imgView];
imgView.frame = CGRectMake(250, 250, 150, 150);
//1.设置动画的时间间隔animationDuration
imgView.animationDuration = 1;
//2.准备并设置动画的素材animationImages
UIImage *img1 = [UIImage imageNamed:@"图1.tiff"];
UIImage *img2 = [UIImage imageNamed:@"图2.tiff"];
NSArray *array = @[img1,img2];
imgView.animationImages = array;
//3.设置动画的重复次数
imgView.animationRepeatCount = 100;
//4.开始动画
[imgView startAnimating];