• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
didReceiveMemoryWarning Confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

didReceiveMemoryWarning Confusion


  • Subject: didReceiveMemoryWarning Confusion
  • From: Monty <email@hidden>
  • Date: Thu, 30 Apr 2009 02:53:43 -0700 (PDT)

I'm having some confusion understanding the expected behavior of UIViewController's response to didReceiveMemoryWarning messages. In Memory Management Programming Guide for Cocoa|Memory Management of Nib Objects, it states "Assuming that it does not have a superview, the view is disposed of..." And in template descendant code also comments "Assuming that it does not have a superview, the view is disposed of". Intuitively I would expect this would be differentiating on whether the view is displayed or not, and it's mentioned incidentally elsewhere that a view being displayed implies it has UIWindow as a superview. Is there any natural case that a view controller's view property would point to something other than the root of a view hierarchy, or is this just a circuitous way of talking about a view being displayed or not?

The second thing is I find this doesn't work as described in practice. Using the template Tab Bar Application as an example I find that switching to the 2nd tab and simulating a memory warning does not result in the 1st tab's view being released. (In this case, [self.view superview] in the didReceiveMemoryWarning method of the 1st tab's view controller confirms the view has no superview.) (As well I have seen a view become released in other cases of didReceiveMemoryWarning where its view controller is beneath the top of a navigation controller stack.)





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: didReceiveMemoryWarning Confusion
      • From: WT <email@hidden>
    • Re: didReceiveMemoryWarning Confusion
      • From: David Duncan <email@hidden>
  • Prev by Date: [ANN] RegexKitLite 3.0 - Release Canidate, feedback wanted
  • Next by Date: Re: #import errors and @class warnings
  • Previous by thread: [ANN] RegexKitLite 3.0 - Release Canidate, feedback wanted
  • Next by thread: Re: didReceiveMemoryWarning Confusion
  • Index(es):
    • Date
    • Thread