0
votes

I have three view controllers (vc1, vc2, vc3) and two navigation controllers (nav1, nav2).

  • nav1 is the entry point of the storyboard.
  • vc1 is the rootViewController of nav1.
  • vc2 is the rootViewController of nav2.
  • nav2 is presented from vc1 through nav1.

Now when I tried to present vc3 from vc2 through nav2, navigation bar is not showing.

2

2 Answers

1
votes

You need to present your controller with navigationController.

ViewController *objVC  = [self.storyboard instantiateViewControllerWithIdentifier:@"viewcontrollerid"];
UINavigationController *navController = [[UINavigationController alloc]initWithRootViewController:objVC];
[self.navigationController presentViewController:navController animated:YES completion:nil];
0
votes

Now, the way iOS works, it will never give you an instance of your navigation controller in a presented view controller because when you present a view controller, it is not added to the viewcontroller stack of the navigation controller. The reason you can see the navigation controller in the other two is because your'e presenting the navigation controller itself and not view controller.