• 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: 2 questions on Cocoa design and "expected" behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2 questions on Cocoa design and "expected" behavior


  • Subject: Re: 2 questions on Cocoa design and "expected" behavior
  • From: Neil Earnshaw <email@hidden>
  • Date: Thu, 11 Sep 2003 22:27:29 +0100

1) Why is an Utility window always receiving the windowWillClose notification even when it has never been displayed?

I would guess that when it is loaded from the nib it has the chance to allocate resources, whether or not it's been displayed. It gets windowWillClose so that it can release those resources. (That's just a guess; no-one else responded so I thought I'd have a stab.)

That's the job of dealloc.

You can arrive at dealloc by many routes and some of those routes might require different actions to be performed along the way. windowWillClose: gives you the opportunity to tailor one of those approaches. 'Cocoa Programming' gives the example of windowWillClose: being used to send documentWillClose: up the responder chain. This allows the document manager to remove the document associated with the window from its document array, thereby releasing the document's resources.

You might not see a reason for a utility window to get the windowWillClose: message in your app. It just comes with being a window, and maybe its proved useful to some else out there.

-Neil
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: 2 questions on Cocoa design and "expected" behavior (From: Stéphane Sudre <email@hidden>)

  • Prev by Date: Re: Notification Issue
  • Next by Date: Re: NSOpenPanel and the New Folder button
  • Previous by thread: Re: 2 questions on Cocoa design and "expected" behavior
  • Next by thread: anything for cocoa other than java or obj-c?
  • Index(es):
    • Date
    • Thread