メモリに解放されませんCAKeyframeAnimationを削除:は、私は、画像のアニメーションを表現するためのImageViewの層にCAKeyframeAnimationを追加している
:私は呼んでアニメーションを開始したいCAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"contents"];
animation.values = arrayOfImages;
[animation setRemovedOnCompletion:YES];
animation.delegate = self;
[animation setValue:delegate forKey:@"AnimatedImageViewDelegate"];
animation.repeatCount = repeatCount;
animation.fillMode = kCAFillModeForwards;
animation.calculationMode = kCAAnimationDiscrete;
[animation setValue:animationName forKey:@"name"];
animation.duration = duration;
[self.layer addAnimation:animation forKey:animationName];
[self.layer setContents:[animation.values lastObject]];
アニメーションが終了したら、完全に削除してメモリを解放します。
[self.layer removeAllAnimations];
[self.layer removeAnimationForKey:animationName];
これを実行し、Instruments-Activity Monitorを使用すると、完全なimageViewをリリースしない限りメモリは解放されません。
UIImageViewを破壊せずにアニメーションメモリを解放するにはどうすればいいですか?
あなたはそれをautoreleasepoolに入れてみることができます – SAKrisT