Re: Sent Actions, Delegates, Outlets
Re: Sent Actions, Delegates, Outlets
- Subject: Re: Sent Actions, Delegates, Outlets
- From: Chris Hanson <email@hidden>
- Date: Thu, 24 Jul 2008 00:37:07 -0700
On Jul 23, 2008, at 11:28 PM, Oleg Krupnov wrote:
Notifications is another point of confusion for me. I would assume
that notifications should be used when multiple observers can be
connected to an "event" exposed by an object, in contrast to a simple
"delegate" outlet, which can only have one connected object. Am I
correct?
They're really for two different things. Often a delegate interface
supports a superset of what notifications will notify observers of;
for example, see the descriptions of the delegates for NSWindow and
NSApplication, and compare them with those classes' notifications.
What I am actually trying to do is to build a custom editor view that
would notify it's parent window when the state of the view changes,
e.g. due to user actions. I think delegate is the right choice,
correct?
Should it really tell its window about user input? Or should it tell
a controller about that user input, and let the controller manage the
rest of the reaction to that input?
The latter is often the design approach taken in Cocoa. A control or
view will take care of turning the press of a key, the click of a
mouse, or some other user action into a higher-level action that's
sent to a controller. It's the controller that does something
meaningful to the application with that action.
-- Chris
_______________________________________________
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: | |
| >Sent Actions, Delegates, Outlets (From: "Oleg Krupnov" <email@hidden>) |
| >Re: Sent Actions, Delegates, Outlets (From: Graham Cox <email@hidden>) |
| >Re: Sent Actions, Delegates, Outlets (From: "Oleg Krupnov" <email@hidden>) |
| >Re: Sent Actions, Delegates, Outlets (From: Graham Cox <email@hidden>) |
| >Re: Sent Actions, Delegates, Outlets (From: "Oleg Krupnov" <email@hidden>) |