I am working on an iPhone application in which several UIViews are dynamically added and removed from the main UIWindow.
When simulating low memory errors in the simulator, I found that not all view controllers receive a didReceiveMemoryWarning notification. Unfortunately, these are the controllers that will benefit most from the implementation of this method.
I cannot find good information on where and how the method is called. I read that it goes to "all UIViewControllers", but this is obviously not the case. Adding a breakpoint to one of the classes that receive the notification is also not particularly enlightening.
This is a complex project, but one way to add these views:
- (void) showMyView
{
if(!myViewController){
myViewController = [[MyViewController alloc]init];
[window addSubview:myViewController.view];
}
}
MyViewController - , MySuperViewController, UIViewController. ; .
, .