0

How to embed a Navigation controller in a container View? When I place the container the first this that shows is a viewController embed to the container, I want to change that viewController to a navigation view and set it rootViewController and other views

Haroun SMIDA
  • 1,106
  • 3
  • 16
  • 32

3 Answers3

1

If you want to add navigation controller with storyboard then it's very simple, just follow these steps: * select the storyboard to which you want to attach a storyboard, *go to toolbar then, * Editor->Embed In->Navigation controller. *your storyboard automatically embedded with navigation controller.

ghoshghosh
  • 196
  • 1
  • 1
  • 9
0

Basically just add the ViewController into a UINavigationController and set the UINavigationController as your rootViewController. Hope that helps:

ViewController *vc = [[ViewController alloc] init];
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:vc];
self.window.rootViewController = nvc;
3vangelos
  • 501
  • 8
  • 15
0

The UINavigationController controls the UIViewController . So the "container" is NavigationController not others.

The same as UITabbarController. If you want to change the view architecture even the rootViewControler. I will tell you my experience.

Like this:

enter image description here

We can switch the login page and homeTabbar container freedom.

if (Boolean conditions) {//show login page
    [self showLoginAndRegisterVC];
} else { //show home Page
    [self showHomeViewController];
}
[self.window makeKeyAndVisible];
Qun Li
  • 1,256
  • 13
  • 13