Re: First Responder
Re: First Responder
- Subject: Re: First Responder
- From: Kyle Sluder <email@hidden>
- Date: Fri, 25 Feb 2011 23:25:05 -0800
On Fri, Feb 25, 2011 at 11:19 PM, koko <email@hidden> wrote:
> Penchant is a great word. Did you know that the average vocabulary is less that 200 words? And I be penchant is not in that set.
>
> I guess I should rethink my design although I got around things by getting a pointer the Menu Item and then setting its target to be my object. I just thought this is a few steps too many
>
> 1. define an outlet - one line of code
> 2. connect the outlet - one IB action
> 3. set the target on the outlet - one more line of code
>
> Seems like a lot. But if my action was in a view in the view hierarchy all is well with just an IB connection.
Yes, this is the point of the responder chain. It is very much related
to what views and windows are onscreen, and where the keyboard focus
happens to be at the time.
If you always want your message to go to the same object (by which I
do _not_ mean "the same type of object in each window"), then it is
appropriate to point the menu item's target property at your object.
But if the object you want to message exists in one or more instance
per window, you should use the responder chain. That might mean that
your window controller might need to respond to the action message and
forward it along to the object in question.
--Kyle Sluder
_______________________________________________
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