Re: Class lookup at runtime
Re: Class lookup at runtime
- Subject: Re: Class lookup at runtime
- From: Ken Tozier <email@hidden>
- Date: Fri, 7 Dec 2007 04:50:59 -0500
You can use this runtime functions to convert class names
id someObj = [[NSClassFromString(<some class name>) alloc] init]
More here
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
Miscellaneous/Foundation_Functions/Reference/reference.html#//
apple_ref/doc/uid/20000055-BCIIIJCI
On Dec 7, 2007, at 4:41 AM, Wesley Smith wrote:
Hi,
I'm trying to figure out how to dynamically get access to a class
instance from a string. Let's say I have a C string with
"NSRectangle" in it. Is there a way to find the NSRectangle class and
then call alloc on it to generate an instance? I see how to get a
Selector from a string, but I haven't found anything about getting a
class object. Is there some part of the Obj-C runtime I can ask for
this info?
thanks,
wes
_______________________________________________
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:
40comcast.net
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