Re: getting a selector for string
Re: getting a selector for string
- Subject: Re: getting a selector for string
- From: Angela Brett <email@hidden>
- Date: Tue, 4 Feb 2003 22:42:12 +1300
At 3:32 AM -0500 4/2/2003, Ken Tozier wrote:
I could have sworn that I saw some way to get a selector for a given
a string that defines a method name, but I can seem to find it now.
For example:
NSString *methodName = @"goToBedItsLate";
SEL methodSelector = SomeUnknownFunction( methodName );
Is there any way to do this?
I was about to go to bed (it's late) when I saw your message and
thought I'd better respond because you said what I was thinking...
even though I know you'll get about 20 replies to this one. It's
NSSelectorFromString( methodName ); and it's in the Objective-C
Runtime section of the Functions section of the Foundation
documentation.
It's one of those features which reminds me of the funky
string-to-method-to-variable-name sort of stuff which could be done
in HyperTalk. :)
--
Angela Brett
Email: email@hidden
Editor,
http://OldScientist.com
Cocoa development:
http://cocoa.co.nz
Homepage:
http://acronyms.co.nz/angela
_______________________________________________
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.