Why isn't viewDidUnload
method called, when I'm not using xib and use alloc/init to initialize my ViewController
when i simulate memory warning for any iOS version via Simulator? It seems as if this method is never called.
If I create controller via alloc/initWithNibName with xib file, viewDidUnload method successfully called. Why does it happend? Does xib file is reqired for all viewcontrollers to normal handling of memory warnings?
I solve my problem. My implementation with no xib just need to add this code:
Constrained by the terms of the beta program, I believe that we're precluded from being able to discuss iOS 6 Beta in any detail, but I might also suggest that you review the bottom of page 6 in the 8 page iOS 6 Beta 1 release notes regarding viewWillUnload and viewDidUnLoad.
viewDidUnload
is called whenever a memory warning is received and its called for each view controller that has a non visible view, such as aUINavigationController
if you push a new view controller and this view controller causes memory shortage the presenting view controllerviewDidUnload
will be called (because its view is not visible)Also note that if you implement
didReceiveMemoryWarning
and do not call[super didReceiveMemoryWarning];
, yourviewDidUnload
does not get calledFor example if you have in your view controller this