Re: Basic runtime function usage - objc_getClass
Re: Basic runtime function usage - objc_getClass
- Subject: Re: Basic runtime function usage - objc_getClass
- From: Sherm Pendley <email@hidden>
- Date: Wed, 23 Nov 2005 15:30:57 -0500
On Nov 23, 2005, at 1:43 PM, Damien Bobillot wrote:
Just a remark. The dedicated Cocoa function to do this is
NSClassFromString :
Class MyClass = NSClassFromString(@"MyClass");
Quite right, but in some contexts it can be easier to call the
runtime function. NSClassFromString() takes an NSString argument, so
it's the one to call if an NSString is what you already have.
But, if you have a C string (passed to you from another language, for
instance), there's not much point in creating an NSString object,
passing it to NSClassFromString(), then releasing it. In that case
it'd be easier to simply pass the C string directly to objc_getClass().
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden