私のアプリケーションはARCにあります。
私のアプリケーションのどのビューにも 1 つの背景画像があり、その画像にはいくつかのアニメーションが継続的に画像を繰り返しています。
問題は次のとおりです。しばらくすると、アプリケーションがバックグラウンドになります。
スタック、グーグル、アップルドキュメントで多くのことを見て試しましたが、満足のいく解決策は得られませんでした。
3つの質問があります。
(1) これを止める方法は?
(2)ARCでメモリを手動で解放する他の方法はありますか。
(3) [self.view removeFromSuperview] を使用する場合。UIView の場合、一部のメモリも ARC で解放されませんでしたか?
MyCode for Animation は
imageview = [[UIImageView alloc] init];
imageview.image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy08" ofType:@"png"]];
[self.view addSubview:imgBubbleAnimation];
imageview.animationImages = [NSArray arrayWithObjects:
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy01" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy02" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy03" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy04" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy05" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy06" ofType:@"png"]],
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluecandy07" ofType:@"png"]],
nil];
[imageview setAnimationRepeatCount:0]; // 0 for continuous
imageview.animationDuration =3.0;
[imageview startAnimating];
そしてサウンドファイルは(特定のボタンがクリックされたときに再生されます)
URL = [NSURL fileURLWithPath: [[NSBundle mainBundle]
pathForResource:@"ect1a" ofType:@"mp3"]];
audioSound = [[AVAudioPlayer alloc] initWithContentsOfURL:URL error:nil];
audioSound.delegate = self;
audioSound.volume = 5.0;
audioSound.numberOfLoops = 0;
[audioSound play];
1 つのビューに 15 個の小さなサウンド ファイルがあり、1 つのビューに 15 個のアニメーションがあります。
すべての特定のアニメーションには、最低 15 枚の画像があります。
ヘルプ、提案、リンク、またはチュートリアルは大歓迎です。