我在应用程序加载并显示其启动屏幕后,我正在做一个简单的png动画。该动画在模拟器中运行,但不在实际的iPhone上,由于内存压力而终止(启动屏幕首先加载)。在调试中,内存以指数级增加至200MB,直至崩溃。仪器显示没有泄漏,全部堆和匿名Vm 9.61 MB。动画在iPhone上完全不显示。即使使用ARC和imageFilePath,动画也终止内存
我已经停止使用imageNamed设置其他帮助主题所建议的动画图像和使用的imageFilePath。它的工作原理和图像在模拟器上加载。我只是不确定还有什么要做。非常感谢帮助。
在didFinishLaunchingWithOptions:
[self.window makeKeyAndVisible];
self.animationView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
NSArray *animationArray = [[NSArray alloc] initWithObjects:
[UIImage imageFromMainBundleFile:@"/Splash_00000.png"],
[UIImage imageFromMainBundleFile:@"/Splash_00001.png"],
//有其中约150所以我会忽略其余
nil];
self.animationView.animationImages = animationArray;
self.animationView.animationDuration = 5.0f;
self.animationView.animationRepeatCount = 1;
[self.animationView startAnimating];
[self.window addSubview:self.animationView];
[self.window bringSubviewToFront:self.animationView];
如果它的需要,这是方法我使用,我从另一个线程获得:
+(UIImage*)imageFromMainBundleFile:(NSString*)aFileName
{
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
return [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", bundlePath, aFileName]];
}
*“这里约有150个”*。那就是你的问题。 –