开发者

UIImagePickerController unloads underlying ViewControllers with memory warning

In my iPhone application, I've noticed that when using the UIImagePickerController it typically causes memory warnings to happen. I've read that this isn't uncommon and I know that my memory footprint is pretty small otherwise.

My problem is that when UIImagePickerController is up and it throws a memory warning, it unloads the view that presented it. After a user selects a video or image, their previously entered data is gone since the view was reloaded.

Is there any way to prevent the view from unloading, or is there a better solution? I've seen simil开发者_Python百科ar questions, but no good solutions.

Thanks for your answers.


Preventing the view from unloading is probably not a good idea, since you're playing a game of chicken with the reaper (i.e. the OS could kill your app for misbehaving).

If you're concerned about losing state information, you could write that data to disk in a temporary file in your application's temp directory, and set a flag in the view/controller that says "reload me from disk".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜