Re: Sent Actions, Delegates, Outlets
Re: Sent Actions, Delegates, Outlets
- Subject: Re: Sent Actions, Delegates, Outlets
- From: Graham Cox <email@hidden>
- Date: Thu, 24 Jul 2008 15:51:32 +1000
On 24 Jul 2008, at 3:34 pm, Oleg Krupnov wrote:
I'm building a custom view
1) What is the recommended way of raising external "events" (at least
that's what they were called in C#) from within a custom view, in
order to trigger actions in other objects that may be observing the
view? I assume it is to use a delegate outlet, right?
one or more of:
NSNotification/NSNotificationCenter
target/action
delegate
KVO
However I noticed that not all views use delegates to trigger external
actions. For example, NSButton don't seem to have a delegate, but they
have the "Sent Actions" section in the menu that appears on Ctrl+click
in the IB, that is initially empty ("selector"), but filled with sent
actions, as I connect the button to other objects. I am confused about
what exact button's event is supposed to trigger those "sent actions"?
Isn't it that even a button can have multiple events, e.g. click,
mouse dragged, mouse roll over etc.? Or is there a "default" event,
like "click", that is used for the sent action?
action is sent to target on a click. The other things you mention are
either not detected or not sent on to the target.
2) I have found that IB automatically treats all member variables of
my custom view's class that are of type "id" or "id<...>" as outlets,
i.e. they appear in the list of outlets on Ctrl+click. This is not
always desirable. How do I prevent some of those variables from being
treated like outlets?
Yep, I noticed that too. Looks like a bug for now.
Graham
_______________________________________________
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