animationImages的动画数组用imageWithCo
代码如下:
//动画
- (void) animation{
//1.判断当前是否下在进行某一个动画,如果是则不进行响应
if([self.iamgeViewisAnimating]) {
return;
}
NSMutableArray *arr=[NSMutableArray array];
//3.1生成图片文件名
NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"头" ofType:@"png"];
UIImage*image = [UIImageimageWithContentsOfFile:imagePath];
NSString *imagePath1 = [[NSBundle mainBundle] pathForResource:@"坐脚" ofType:@"png"];
UIImage*image1 = [UIImageimageWithContentsOfFile:imagePath1];
[arraddObject:image];
[arraddObject:image1];
self.iamgeView.animationImages=arr;
//5.设置动画属性:如速度,重复次数
self.iamgeView.animationDuration=0.5;
self.iamgeView.animationRepeatCount=1;
//6.开启动画
[self.iamgeView startAnimating]; [self.iamgeViewperformSelector:@selector(setAnimationImages:)withObject:nilafterDelay:0.5+1];
}
动画结束以后并不会马上清除内存需要等待一段时间
动画之前的内存
大概40s以后内存释放