allocing an object based on a string name

Posted by Roger Gilbrat on Stack Overflow See other posts from Stack Overflow or by Roger Gilbrat
Published on 2010-04-07T17:30:48Z Indexed on 2010/04/07 17:33 UTC
Read the original article Hit count: 313

Filed under:
|

Is there a way in objective-c/Cocoa to alloc an object when the class name isn't know until run-time. I seem to remember something about this a while ago, but can't find anything on it now.

Something like:

[[@"MyClass" alloc] init];

I seem to recall a function that would return some kind of class id based on a string that can then be used to alloc the object.

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about cocoa