开发者_开发百科When I run my app on the simulator, then I go Hardware->Simulate Memory Warning it causes my view to go blank (I just see white). Does anyone know how I can make it NOT do that? -- I don't want an actual memory warning to make my screen blank.
Thanks
I'm having the same issue. I have an application where you're presented a login screen, which pushes under a NavController a main menu. Every selection in the main menu then pushes a new view controller. If i get a memory warning when under a menu item, going back to the menu displays a blank view.
This is probably more of masking the symptom than fixing the problem, but by overriding my main menu's didReceiveMemoryWarning
message with an empty one (so that the super version isn't being called) stopped the view from disappearing.
I like this better than overriding setView
(as recommeneded here) because you don't get the pesky performance warning about "-viewDidUnload caused the view to be reloaded."
I got the same issue right now and I solved the problem.
In my case I got this lines inside the mainViewController's code:
- (void)loadView {
[super loadView];
}
after simulating a memory warning the system call didReceiveMemoryWarning and you can check that viewDidUnload is called immediately after and if you use loadView inside your code the class call it to reload a brand new page that replace your old view. This cause a blank screen.
So to solve the issue I just commented the three line above.
bah, it was mainly because I set my navigation controller incorrectly
精彩评论