Storing Object Types in Variable then Initializing
- by Jon Mattingly
Is there a way in Objective-C to store an object/class in a variable to be passed to alloc/init somewhere else?
For example:
UIViewController = foo
foo *bar = [[foo alloc] init]
I'm trying to create a system to dynamically create navigation buttons in a separate class based on the current view controller. I can pass 'self' to the method, but the variable that results does not allow me to alloc/init. I could always import the .h file directly, but ideally I would like to make reusing the code as simple as possible. Maybe I'm going about this the wrong way?