[Bug in sample Code] On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired

Documet Link

http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPho neOS/ViewLoadingandUnloading/ViewLoadingandUnloading.html#//apple_ref/doc/uid/TP 40007457-CH10-SW15


On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired

Listing 4-3 Releasing the views of a view controller not visible on screen

- (void)didReceiveMemoryWarning

{

[super didReceiveMemoryWarning];

// Add code to clean up any of your own resources that are no longer necessary.

if ([self.view window] == nil)

{

// Add code to preserve data stored in the views that might be

// needed later.


// Add code to clean up other strong references to the view in

// the view hierarchy.

self.view = nil;

}

}


The Condition should be [self isViewLoaded] && [self.view window] == nil

Posted on Apr 1, 2013 3:42 AM

Reply

There are no replies.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

[Bug in sample Code] On iOS 6 and Later, a View Controller Unloads Its Own Views When Desired

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.