Background
I have a tab bar app. Each tab contains a navigation controller that allows the user to switch from one view to another, showing data granularity information (each view is processed by the view controller, and each view controller class has a didReceiveMemoryWarning method). Lists are populated by pulling data from web services.
Problem
When I use the "Hardware> Simulate Memory Warning" option for iPhone Simulator, the didReceiveMemoryWarning method didReceiveMemoryWarning called for ALL of my view controllers β even the one that the user is viewing. I do not want to clear the content that is used by the active view controller. How can i achieve this?
What method should an implementation have to reload data after the data has been released due to a memory warning? (I see that the view controller classes containing the method to call the viewDidLoad table when the user returns to this view, but if the view contains (for example, UIWebView), then the viewDidLoad method viewDidLoad not called. Why is this?)
Edited (Friday January 30, 2009 - 3:10 p.m.)
(Note: I am using an interface constructor to create views, and the loadView method loadView commented out.)
So, when the view controller receives a warning message about the memory, these are the steps that are performed:
The following method is called:
- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; }
As a result of calling [super didReceiveMemoryWarning] , [self setView:nil] automatically called?
If any resources need to be cleared, then the setView method must be rewritten to clear local resources.
[self setView:nil] not called if the view is currently active (default). Right? βI'm really interested in which method makes this decision and how?β
Could you confirm. Also, I was getting an error following this approach, but adding myObject = nil after releasing myObject to dealloc the controller class method fixed the problem. Thank.
memory iphone warnings simulator
Mustafa Jan 29 '09 at 10:00 2009-01-29 10:00
source share