this question relates dynamically initializing different view controllers based on runtime options. basically, when app starts up, web service sends piece of xml/json down define user preferences etc.
we need determine view controller shown user next, based on these variables. have class asks questions (which features turned on/off etc), , need able return class or initialize class based on this. since not want import every view controller header in each view controller, how initialize class using method such as:
[[self nextclassmanager] getnextclass];
thanks
i use similar open view controller server command, according controller class name:
- (void)openviewcontroller:(nsstring *)thecontrollerclassname { class thecontrollerclass = nsclassfromstring(thecontrollerclassname); if (thecontrollerclass && [thecontrollerclass issubclassofclass:[uiviewcontroller class]]) { uiviewcontroller* controller = [[thecontrollerclass performselector:@selector(alloc)] init]; uinavigationcontroller *nav = (uinavigationcontroller *)self.tabbarcontroller.selectedviewcontroller; [nav pushviewcontroller:controller animated:yes]; [controller release]; } }
Comments
Post a Comment