There are times when didReceiveMemoryWarning gets called, but viewDidUnload does not. In my situation I would like to force viewDidUnload when didReceiveMemoryWarning gets called.
I can say this:
[self viewDidUnload];
But will that really unload the views? There is no self “unloadView”.
Why would you want to do this? As long as you remember to call
[super didReceiveMemoryWarning](assuming you implement the method at all), UIViewController automatically unloads its view if its view has no superview. If this process does not happen, that generally indicates that the view is still part of a view hierarchy and it’s not safe to unload.In the rather unlikely case that you really do need to manually unload a view, you can do so simply by saying
self.view = nil.