在iOS 4.0上使用大图片时发生应用程式崩溃 [英] App Crashing when using large images on iOS 4.0
问题描述
我一直有一个问题,在scrollview显示大图像,图像是2,4 - 4,7 MB。它在3GS和模拟器上运行良好。但是每当我尝试在3G或iPod Touch 2G上运行时,都会崩溃。
我在网上搜索,发现imageNamed is evil Ok我把所有的图像调用更改为imageWithContentsOfFile:但它仍然崩溃,唯一不同的是,我看到的是,现在图像被释放后,我离开视图就好了。但是内存使用率仍然很高。
这是Instruments的屏幕截图。
第一个高峰是我在启动时显示的视频,然后tableview显示了很多图片,直到那时没有问题。
当我输入1,1mb - 2576 x 1000照片
当我输入4,8mb - 7822 x 1000照片 / p>
通过在iOS 4和3.1.2上测试应用程序的方式
您有任何提示吗?
>
我最终使用UIWebView,我不得不使用较小的(MB,而不是维度)图像,但它的工作,唯一的问题是,我不能缩放...使用scalePageToFit我可以缩放,但图像
如果有人拥有这个问题我建议使用webview或适配器版本的three20图像查看器更好地处理内存。
I've been having a problem to show large images on a scrollview, the images are 2,4 - 4,7 MB. It runs fine on the 3GS and on the simulator. But whenever I try to run on a 3G or iPod Touch 2G, it crashes.
I searched across the web and found the "imageNamed is evil" article. Ok I changed all my image calls to imageWithContentsOfFile: but it still crashes, the only different that I see is that now images are deallocated after I leave the view just fine. But the memory usage is still very high.
Here is a screenshot of Instruments. First peak is a video I show at startup, then the tableview shows a lot of images, until then no problems.
When I enter a 1,1mb - 2576 x 1000 picture
When I enter a 4,8mb - 7822 x 1000 picture
By the way the app was tested on iOS 4 and 3.1.2
Do you have any tips? Because this problem is driving me nuts.
Since now thanks a lot!
I ended up using UIWebView, I had to use smaller (in MB, not dimensions) images but it's working on, the only problem Is that I can't zoom... Using the scalePageToFit I can zoom but the image fits horizontally not vertically, that sux.
I will try to keep this issue updated.
If someone has this problem I would advice to use webview or an adapter version of three20 image viewer that handles memory better.
这篇关于在iOS 4.0上使用大图片时发生应用程式崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!