加载大量图像时崩溃

时间:2012-10-09 09:36:33

标签: iphone

我正在创建一个应用程序,其中我正在为Imageview加载800 jpg图像。出现不同的敌人不同的图像集将加载动画。在第一个事件的火灾它工作正常但在第二个事件它崩溃在iPhone上。有什么帮助吗? 我的代码部分如下

for (int aniCount = 1; aniCount < 480; aniCount++){
UIImage *frameImage = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource: [NSString stringWithFormat: @"ani_soft_whimper_%i", aniCount] ofType: @"jpg"]];
[_arr_ImagesSoftWhimper addObject:frameImage];
}
imageView.animationImages = _arr_ImagesSoftWhimper;

我正在为这些图像集崩溃。

2 个答案:

答案 0 :(得分:0)

您可能内存不足。但这只是猜测。请提供一些代码。

答案 1 :(得分:0)

1.如果您从任何服务器下载,请拨打异步电话。 2.根据uiimageview框架检查图像尺寸,尺寸,尺寸是否大,然后先调整尺寸或裁剪图像,然后设置为uiimageview。