If an application receives a low memory warning and a view controller releases the view, how does one reload the view the next time it's needed. I have my views defined in a .xib file and on earlier iphones, the views are being set to nil. Where/when/how do I recreate these views if they are removed?
Asked
Active
Viewed 666 times
1
-
It should work magically, didn't it? How did you create your view controller? – iwat Jun 29 '10 at 04:38
-
Using initWithNibName and a .xib file. – typeoneerror Jun 29 '10 at 07:36
-
Should I not set the stuff defined in the nib to nil when I get a memory warning? – typeoneerror Jun 29 '10 at 07:36
1 Answers
1
I was writing my code pretty much horribly wrong. I was setting views to nil in viewDidUnload but all my creation was done in init. So when the application received a memory warning, when I went back to that view controller, the views were gone. This answer helped me realize my mistake; namely, that additional views could be added to viewDidLoad so that if they are released due to memory warnings in viewDidUnload, they can be recreated.

Community
- 1
- 1

typeoneerror
- 55,990
- 32
- 132
- 223