Re: Class lookup at runtime
Re: Class lookup at runtime
- Subject: Re: Class lookup at runtime
- From: Rob Keniger <email@hidden>
- Date: Fri, 7 Dec 2007 19:48:27 +1000
On 07/12/2007, at 7:41 PM, 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?
You're looking for the Foundation function NSClassFromString().
--
Rob Keniger
_______________________________________________
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