//使用gif动态图片
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 320, 323)];//初始化imageView.center = CGPointMake(160, 230);//中心坐标
imageView.backgroundColor = [UIColor grayColor];//背景颜色
NSMutableArray *images = [[NSMutableArray alloc]initWithCapacity:6];//因为这个动态图片是由6张图片组成所有把图片放到一个数组中
for (int i=0; i<6; i++) {
NSString *imageName = [NSString stringWithFormat:@"1-%d(被拖移).tiff",i+1];//for循环依次把图片取出 这里我的图片名为1 - %d为i的值
UIImage *image = [UIImage imageNamed:imageName];
[images addObject:image];
}
//给imageView 制定了一组用于做动画的图片
imageView.animationImages = images;
//动画的总时长(一组动画坐下来的时间 6张图片显示一遍的总时间)
imageView.animationDuration = 1;
imageView.animationRepeatCount = 3;//动画进行几次结束
[imageView startAnimating];//开始动画
// [imageView stopAnimating];//停止动画
[self.view addSubview:imageView];