I have a UITabBar with 2 view controller. The first one shows a UITableView, second one shows a UITextView. When I click the first tab to show the tabview, and issue the memory warning in the simulator, the UITextView's didReceiveMemoryWarning is called automatically, however, the viewDidUnload is not getting called. When I tap the second tab to show the textview, and issue the memory warning in the simulator, the first view controller's didReceiveMemoryWarning is called automat开发者_如何学运维ically, and the viewDidUnload is called as well. So I want to know why the second view controller's viewDidUnload method is not called. Also, how can I make the first view controller(the one shows table view) viewDidUnload method is not called automatically when the app receive memory warning message. Thanks.
Apple documentation implies that automatic view unloading only happens when the view was loaded from a named NIB file. If the UITextView view was created manually that would explain the unloading.
As to the second part, from what I've tried, there is no way to prevent the automatic unloading as it happens in the base class. If there is a way to create the view and "hide" the fact it came from a NIB, that might do it.
精彩评论