Re: NSWindow
Re: NSWindow
- Subject: Re: NSWindow
- From: Shaun Wexler <email@hidden>
- Date: Sat, 18 Jan 2003 10:42:50 -0800
On Saturday, January 18, 2003, at 10:20 AM, mw wrote:
No! Don't do that! You never want to override a standard delegate
method
with a notification center method!!! If your object is a delegate of
the
window that you want to display the save sheet on, then scrap the
NSNotificationCenter code at the top of the above example. If it isn't
a
delegate, then change the name of the method to something other than
windowWillClose: for clarity's sake.
Yes, thanks. Using a unique name for non-delegate notifications is
good practice. I did not assume he was using a window delegate (or had
read the NSWindow doc's), otherwise he might have known to use the
notification. In NSWindow, with the sheer number of notifications
available, I feel it is more efficient to register for specific
notifications (if you only need a few) than to use a delegate. If more
than one object needs to keep track of many windows, it may become more
confusing as to which one is the delegate for a particular window.
Having the window query the delegate for each supported method and
registering for all of them doesn't seem efficient, especially with
multiple windows, unless you need most of the methods or just want the
convenience (or rely on the reverse link to the delegate object).
Actually, it's not a substantial performance savings at all, just
semantics... ;)
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
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.