Re: didReceiveMemoryWarning Confusion
Re: didReceiveMemoryWarning Confusion
- Subject: Re: didReceiveMemoryWarning Confusion
- From: David Duncan <email@hidden>
- Date: Thu, 30 Apr 2009 09:49:27 -0700
On Apr 30, 2009, at 2:53 AM, Monty wrote:
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?
To be quite honest, you don't need to know the details of how it makes
the decision to release the view, as long as you respect that
decision. But the answer is along the lines of "if the view does not
have a superview, release the view". There are exceptions however. The
super view will not always be a UIWindow.
The second thing is I find this doesn't work as described in
practice. Using the template Tab Bar Application as an example
This is a bug involving UITabBarControllers that causes some child
view controllers to always have a super view and thus defeat the
default behavior.
--
David Duncan
Apple DTS Animation and Printing
_______________________________________________
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