• 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: Sending a Selector to another Class.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending a Selector to another Class.


  • Subject: Re: Sending a Selector to another Class.
  • From: Jim Kang <email@hidden>
  • Date: Wed, 21 Oct 2009 12:43:53 -0400

That selector is a unique index that points to a method of a specific class.
Methods themselves belong to a specific class and can't operate outside of
their classes. (They compile down to regular C functions that accept an
additional object parameter.)
So, it doesn't make sense to use one class's selector on another class.
Maybe these two classes should inherit from a common parent that has the
method you want to share.

On Wed, Oct 21, 2009 at 12:23 PM, Joshua Garnham <email@hidden
> wrote:

> How would I send a Selector to another class?
> I know to send it to a selector in the same file you do
> [self performSelector:@selector(doSomething)];
>
> and for sending it to another class I've tried
> [otherClass performSelector:@selector(doSomethingElse)];
>
> But I just get an error in the Debugger saying
> +[otherClass doSomethingElse]: unrecognized selector sent to class 0xe5c4
>
> What have I done wrong?
>
> Thanks.
>
>
>
> _______________________________________________
>
> 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
>
_______________________________________________

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: Sending a Selector to another Class.
      • From: Jens Alfke <email@hidden>
References: 
 >Sending a Selector to another Class. (From: Joshua Garnham <email@hidden>)

  • Prev by Date: Applying a Core Image filter to a PDFView, WebView or any view
  • Next by Date: Re: Displaying a view modally
  • Previous by thread: Re: Sending a Selector to another Class.
  • Next by thread: Re: Sending a Selector to another Class.
  • Index(es):
    • Date
    • Thread