Re: Delegates
Re: Delegates
- Subject: Re: Delegates
- From: Mike Abdullah <email@hidden>
- Date: Mon, 19 May 2008 22:16:19 +0100
On 19 May 2008, at 21:23, I. Savant wrote:
On Mon, May 19, 2008 at 2:54 PM, Michael Vannorsdel <email@hidden
> wrote:
There's nothing that guarantees a Cocoa delegate will act for
another object
and that the represented object won't act how it wants as well.
Sometimes a
delegate method is just a notification something happened/happening
without
the delegate having any say on the matter or affect on the
represented
object's course of action on that matter.
Yes, but the delegating object *always* follows this pattern:
- I'm doing something for which I can ask a delegate for assistance or
advice or in which the delegate might be interested, so ...
- If I have a delegate ...
- If the delegate responds to this particular delegate message
- Send the message to the delegate and *wait for it to return* (ie,
it's all within the same trip around the run loop, unlike
notifications).
Um, that's wrong. To quote:
A notification center delivers notifications to observers
synchronously. In other words, the postNotification:methods do not
return until all observers have received and processed the
notification. To send notifications asynchronously use
NSNotificationQueue
Indeed, most -fooDidBar: style delegate methods are implemented via
NSNotificationCenter. But of course that's just an implementation
detail that probably doesn't matter to the OP.
Mike.
_______________________________________________
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