美文网首页
animationImages的动画数组用imageWithCo

animationImages的动画数组用imageWithCo

作者: 哪有猫不吃鱼 | 来源:发表于2020-11-03 10:06 被阅读0次

代码如下:

//动画

- (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以后内存释放

使用UIImageView的animationImages的图片如果想要内存管理,建议使用imageWithContentsOfFile加载图片,图片格式最好不好用png!!!!

相关文章

网友评论

      本文标题:animationImages的动画数组用imageWithCo

      本文链接:https://www.haomeiwen.com/subject/sllbvktx.html