0
我的应用程序在ARC中。
在我的应用程序的任何视图中都有一个背景图像,并且在该图像上,一些动画不断重复图像。应用程序在后台进行
问题是:我的应用程序将在一段时间后进入后台。
我看到并尝试了很多堆栈,谷歌和苹果文档的东西,但没有得到满意的解决方案。
我有三个问题。
(1)如何阻止? (2)是否有任何其他方法在ARC中手动释放内存。 (3)如果我使用[self.view removeFromSuperview];对于UIView,那么还有一些内存没有在ARC中发布?
mycode的动漫是
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];
我有一种观点认为15个小的声音文件和15个动画的一个观点。
在每一个特定的动画有最少15图像。
欢迎任何帮助,建议,链接或教程。
我试过这不工作,我没有使用计时器兄弟。我只是在viewDidLoad中编码整个事物。并且应用程序停止并进入后台。你有没有关于如何在ARC中手动释放动画内存的想法。它会很有帮助 – Sam
这并不需要你使用计时器来工作。它阻止了应用程序进入睡眠状态。 (不是背景,背景是不同的) –
通过确保注释(强)指向ARC来释放ARC中的对象。无所有引用并从数组中删除对象或无对数组的引用等。 –