iphone - Add UINavigationController inside UIViewController -


i have uiviewcontroller uitoolbar (on bottom) , want add uinavigationcontroller uinavigationbar inside. uinavigationcontroller not displayed.

myviewcontroller.m :

- (void)viewdidload {     [super viewdidload];      int toolbarheight = 44;     uitoolbar *toolbar = [[uitoolbar alloc] initwithframe:cgrectmake(0, [self.view bounds].size.height-toolbarheight, [self.view bounds].size.width, toolbarheight)];      uibarbuttonitem *button = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemrefresh target:nil action:nil];     toolbar.items = @[button];      [self.view addsubview:toolbar];      mynavigationcontroller *mynav = [[mynavigationcontroller alloc] init];      [self addchildviewcontroller:mynav]; } 

adding view controller child view controller isn't enough. need add navigation controller's view subview of container view controller's view.

[mynav willmovetoparentviewcontroller:self]; mynav.view.frame = navframe;  //set frame or constraints [self.view addsubview:mynav.view]; [self addchildviewcontroller:mynav]; [mynav didmovetoparentviewcontroller:self]; 

see the view controller programming guide more details.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -