• 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: Class lookup at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Class lookup at runtime (From: "Wesley Smith" <email@hidden>)

  • Prev by Date: Class lookup at runtime
  • Next by Date: Re: Class lookup at runtime
  • Previous by thread: Class lookup at runtime
  • Next by thread: Re: Class lookup at runtime
  • Index(es):
    • Date
    • Thread