ios - Adding UINavigationController to root UIViewController using addChildViewController -
what want have root view controller manages base view of application , add uinavigationviewcontroller (with own view controller stack) view controller using ios 5+ containment api addchildviewcontroller().
edit: purpose of base view controller control dynamic view consistent background across application. there animations involved actual background view needs stay same across every view.
my question whether best practice , apple-approved way accomplish such design? have been reading conflicting advice in research , want make sure app not rejected.
here code appdelegate, shows trying do:
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { baseviewcontroller * base = [[baseviewcontroller alloc] init]; playerviewcontroller * player = [[playerviewcontroller alloc] init]; uinavigationcontroller * nav = [[uinavigationcontroller alloc] initwithrootviewcontroller:player]; [nav setnavigationbarhidden:yes]; [base addchildviewcontroller:nav]; [base.view addsubview:nav.view]; [self.window setrootviewcontroller:base]; [self.window makekeyandvisible]; return yes; }
thanks help.
Comments
Post a Comment