views:

337

answers:

1

Is there an equivalent of selectors for classes? How can I create a instance of a class from a string?

+7  A: 

You want NSClassFromString.

NSString *theClassForMe = @"NSMutableArray";
id newObject = [[NSClassFromString(theClassForMe) alloc] init];
Jim Puls