This issue never happened to me. I have an UIViewController inside an UINavigationController. When a memory warning is received (nevermind the level), the viewDidUnload
method of the visible controller is called, so the view is unloaded and I get an awesome black screen (with a navigation bar at the top).
I'm testing with an iPad 1 on iOS 4.3.3.
Any suggestions?
From what I understand, the viewDidUnload
method is called by didRecieveMemoryWarning
function in the UIViewController
(the super class). Basically iOS gives you couple of warnings and expect to see your memory usage go down. If you continue to ignore these, OS will kill your app.
Sometimes, though, it is critical to keep some views up and running so the way I get around this is to simply override the didRecieveMemoryWarning
method and inside it, don't do anything.
Or better yet, check if self
is the current view in the self.navigationController.visibleViewController
, and if so, don't pass the memory warning call down to [super didRecieveMemoryWarning]
.
If you are holding image caches or something, just empty those instead.
HTH
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With