• 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: about @selector
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about @selector


  • Subject: Re: about @selector
  • From: Andy Lee <email@hidden>
  • Date: Thu, 9 May 2002 18:50:10 -0400

At 6:24 PM -0400 5/9/02, Antonio Inojal wrote:
But what does @selector(drawAnother:) do? In specific what is the @selector used for?

The Objective-C compiler translates method names into unique numbers called selectors. Manipulating these numbers at runtime is a lot more efficient than dispatching messages via actual strings containing their name.

The expression "@selector(drawAnother:)" translates to "the unique number (i.e., selector) corresponding to the method name 'drawAnother:'." The datatype of the expression is SEL, which is typedef'ed somewhere in the low-level Objective-C headers.

The language docs on Objective-C, under /Documentation, no doubt explain this better than I just did. I think @selector is technically a "compiler directive."

--Andy
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >about @selector (From: Antonio Inojal <email@hidden>)

  • Prev by Date: CocoaDevCentral Sheets Tutorial
  • Next by Date: Re: Hiding superclass methods
  • Previous by thread: Re: about @selector
  • Next by thread: Re: about @selector
  • Index(es):
    • Date
    • Thread