SO 问题来了

全景动画

2016-09-06  本文已影响12人  失忆的程序员

#在界面上添加图片容器

## UIImageView关联界面上的图片容器

@property (weak, nonatomic) IBOutlet UIImageView *imageContainer;

##定义容易保存所有图片

// 1.定义容器保存所有图片

NSMutableArray *arrM =[NSMutableArray array];

// 2.加载所有图片

for (int i = 1; i <= 36; i++) {

NSString *imageName = [NSString stringWithFormat:@"img_360car_black_%02d", i];

UIImage *image = [UIImage imageNamed:imageName];

[arrM addObject:image];

}

// 3.将图片设置给图片容器

self.imageContainer.animationImages = arrM;

// 4.监听屏幕点击方法

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {

// 1.设置动画时长

self.imageContainer.animationDuration = 5;

// 2.设置动画重复次数

self.imageContainer.animationRepeatCount = 1;

// 3.开始动画

[self.imageContainer startAnimating];

}

上一篇 下一篇

猜你喜欢

热点阅读