• 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
Re: MemoryWarning and loadView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: MemoryWarning and loadView


  • Subject: Re: MemoryWarning and loadView
  • From: David Duncan <email@hidden>
  • Date: Mon, 24 Jan 2011 09:42:38 -0800

On Jan 24, 2011, at 8:52 AM, Bleicher Eiko wrote:

> I want to get a deeper understanding of the memory warning handling on iOS in UIViewControllers.
>
> It seems that the default implementation of didReceiveMemoryWarning will set the view to nil, and viewDidUnload gets called. *But* this is only done when the controller implements loadView. Even if this method does nothing at all except calling [super loadView].
>
> What is the reasoning behind making this behavior dependent on the existence of loadView? Also wondering how this is checked, as "respondsToSelector" might not be enough because the superclass implements it anyway?


The logic of unloading its view hierarchy depends on the ability for the view controller to reload that view hierarchy. The typical cases for this are either 1) you implement -loadView to create a view hierarchy programmatically or 2) you assign the view controller a nib to load. A plain old UIViewController should also respond to memory warnings by unloading its view, as it conforms to these conditions.

The most common case whereupon a view controller cannot unload its views is when the view controller is included in the same nib as its views (and thus archived along with those views).
--
David Duncan

_______________________________________________

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

References: 
 >MemoryWarning and loadView (From: Bleicher Eiko <email@hidden>)

  • Prev by Date: NSOutlineView syncing demo project
  • Next by Date: how to retrive a part of image from a png/bitmap
  • Previous by thread: MemoryWarning and loadView
  • Next by thread: NSOutlineView syncing demo project
  • Index(es):
    • Date
    • Thread