使用UIImagePicker一次后发出内存警告 [英] Memory warning after using the UIImagePicker once

查看:116
本文介绍了使用UIImagePicker一次后发出内存警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提到了这个非常好的参考资料: http://stackoverflow.com/questions / 1282830 / uiimagepickercontroller-uiimage-memory-and-more ,但我有一些非常严重的问题。我拍照后,我收到一个记忆警告。这是我拍的第一张照片,而不是第二张或第三张照片。



我想知道是否是因为我从应用程序目录中加载了几个小jpeg进入滚动视图。我可以想到的唯一的解决方案是卸载在我的主视图中的一切,而UIImagePicker是活跃的,然后重新加载一切再次,但我不知道这是正确的解决方案,我不知道该怎么做。 >

UIImagePicker是否使用了这么多内存?我甚至还没有处理或显示它所需的图像。



任何帮助感谢。

解决方案

是的,这发生了。要记住的事情是,它可以得到一个内存警告,这并不意味着你是一个坏人,你只需要确保你的应用程序不会崩溃或被困惑响应内存警告。 / p>

特别是,你需要明白,UIViewController的默认动作是卸载它的视图,如果它们不可见,并且它们将不可见,屏幕图像选择器正在显示。


I've referred to this very good reference: http://stackoverflow.com/questions/1282830/uiimagepickercontroller-uiimage-memory-and-more but I'm having some very serious issues. After I take a photo, I receive a memory warning. This is for the first photo I take, not the second or third.

I was wondering if it's because I've got a couple of small jpegs loaded from the application directory into scrolling views. The only solution I can think of is to unload everything in my mainview whilst the UIImagePicker is active, and reload everything again afterwards, but I'm not sure that's the correct solution and I'm not sure how to do that.

Does the UIImagePicker use up that much memory? I haven't even got as far as processing or displaying the image it takes yet. I get a memory warning, even if I throw the image away.

Any help appreciated.

解决方案

Yes, this happens. The thing to remember is that it's okay to get a memory warning, it doesn't mean you're a bad person, you just need to make sure that your application doesn't crash or get confused in response to the memory warning.

In particular, you need to understand that the default action of UIViewController is to unload its views if they're not visible, and they won't be visible if the full-screen image picker is showing.

这篇关于使用UIImagePicker一次后发出内存警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆