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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to