substitute class at runtime?
substitute class at runtime?
- Subject: substitute class at runtime?
- From: Nathaniel Gottlieb-Graham <email@hidden>
- Date: Fri, 18 Jul 2008 14:00:22 -0400
I need to be able to initialize a class, but I don't necessarily know
what kind of class it'll be at compile time. Consider the following
example in which the name of a class is checked against an array of
class names, and if the name of the class is present in the array, a
new instance of that class is initialized:
NSString *nameOfClass = fooViewController
NSArray *classNameArray = [NSArray arrayWithObjects:
@"FooViewController", @"BarViewController", nil];
if ([classNameArray containsObject:nameOfClass])
{
[[[??????? alloc]initWithNibName:nameOfClass] autorelease]
}
How can I get the class name into the ??????? part?
_______________________________________________
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