• 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: NSApp sendAction
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApp sendAction


  • Subject: Re: NSApp sendAction
  • From: glenn andreas <email@hidden>
  • Date: Wed, 23 Nov 2005 12:05:25 -0600


On Nov 23, 2005, at 11:08 AM, Brian O'Brien wrote:


On 23-Nov-05, at 9:57 AM, j o a r wrote:


On 23 nov 2005, at 17.54, Nick Zitzmann wrote:

You should probably use the -[NSObject performSelector:] family of methods instead.

Or failing that, use NSInvocation.

j o a r




So how about ...
- (id)performSelector:(SEL)aSelector withObject:(id)anObject withObject:(id)anotherObject
?
Pardon me if I need some help here....


[reply performSelector:@selector(seriesReceivedInArray:fromPort:) withObject:dataSets withObject:portNumber];

Where reply is the instance of the object whose selector I want to call?
Of course this object must inherit from NSObject...

If you're going to write that, might as well just write:

[reply seriesRecievedInArray: dataSets fromPort: portNumber];

Since that does the same thing and is much clearer.

The beauty of things that take selectors and perform them isn't using them with hard-coded selectors (since you can just call the thing with that selector from the get go), but rather that the selector can be a variable (such as the action in a menu item or action cell).

NSApp's sendAction:to:from:, however, is different, because it uses the responder chain to determine who to send something to (if you pass NULL as the target).

It sounds like this isn't what you want, because what you're sending doesn't fit the classic model of an "action" that should go up the responder chain.




Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! Widgetarium | the quickest path to widgets

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSApp sendAction (From: "Brian O'Brien" <email@hidden>)
 >Re: NSApp sendAction (From: Nick Zitzmann <email@hidden>)
 >Re: NSApp sendAction (From: j o a r <email@hidden>)
 >Re: NSApp sendAction (From: "Brian O'Brien" <email@hidden>)

  • Prev by Date: Re: Reverse value transformation with different class?
  • Next by Date: Re: Thread Safety of performSelector:withObject:afterDelay:?
  • Previous by thread: Re: NSApp sendAction
  • Next by thread: Re: NSApp sendAction
  • Index(es):
    • Date
    • Thread