Re: 2 questions on Cocoa design and "expected" behavior
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.