• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Abusing targetForAction: with non-action selectors
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Abusing targetForAction: with non-action selectors


  • Subject: Re: Abusing targetForAction: with non-action selectors
  • From: Graham Cox <email@hidden>
  • Date: Tue, 16 Sep 2008 09:56:54 +1000


On 16 Sep 2008, at 9:51 am, Dave Dribin wrote:

I've got, say, an info panel that needs to display different stuff based on some object in the responder chain. What I really want to do is search the responder chain for an object that conforms to a specific protocol. I was just picking a method in the protocol as the argument to targetForAction:. I think the "safe" way is to put a dummy "marker" action on the protocol and then search the responder chain for that action. Then, check the target to make sure it actually conforms to the protocol.


I think you have this a bit backwards, possibly.

You still have to get notified when the first responder changes in order to tell your info panel to reorganise itself, so why not use that notification to directly obtain the correct target? Objects that can be displayed by your info panel will send a notification that they have become active, sending themselves as the notifier. The info panel receives that notification and so already has the desired target. It then just needs to check what protocols or methods the notifier responds to and set up its UI accordingly.

I believe this is the conventional approach to inspectors and the like.

hth,

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


  • Follow-Ups:
    • Re: Abusing targetForAction: with non-action selectors
      • From: Dave Dribin <email@hidden>
References: 
 >Abusing targetForAction: with non-action selectors (From: Dave Dribin <email@hidden>)
 >Re: Abusing targetForAction: with non-action selectors (From: Graham Cox <email@hidden>)
 >Re: Abusing targetForAction: with non-action selectors (From: Dave Dribin <email@hidden>)

  • Prev by Date: Re: Abusing targetForAction: with non-action selectors
  • Next by Date: Re: Abusing targetForAction: with non-action selectors
  • Previous by thread: Re: Abusing targetForAction: with non-action selectors
  • Next by thread: Re: Abusing targetForAction: with non-action selectors
  • Index(es):
    • Date
    • Thread