模拟的低内存警告不起作用 [英] Simulated low memory warning not working
问题描述
我在 UIViewController
中有一个 UIWebView
。我试图将此视图控制器推送到现有的 UINavigationController
,它有另一个视图控制器,其中还有一个 UIWebView
它。在推送第一个视图控制器之后,我尝试模拟内存警告,然后我点击返回转到上一个视图控制器,但现在这个webview为空/空白。关于如何解决这个问题的任何想法?
I have a UIWebView
in a UIViewController
. I am trying to push this view controller to an existing UINavigationController
, that has another view controller which also has a UIWebView
in it. After pushing the first view controller I try to simulate a memory warning, and then I hit "back" to go to the previous view controller, but now this webview is empty/blank. Any idea on how to go around this?
这只发生在运行iOS 5的iPad 1上。
This is only happening on the iPad 1, running iOS 5.
推荐答案
在iOS 5.x或更早版本的低内存条件下,可以卸载视图控制器的视图。然后当需要再次加载时,视图控制器的 viewDidLoad
将在视图重新放回后调用。确保你在 viewDidLoad
和 viewDidUnload
中做正确的事情来处理这种情况。
Under a low memory condition under iOS 5.x or earlier, a view controller's view may be unloaded. Then when it needs to be loaded again, the view controller's viewDidLoad
will be called after the view is put back in place. Make sure you are doing the right things in viewDidLoad
and viewDidUnload
to handle this case.
这篇关于模拟的低内存警告不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!