2

I am new to modal views and cant seem to get a navigation view display in a modal view.

How do I build a navigation view in the modal view?

Matthew Pateman
  • 1,009
  • 3
  • 11
  • 20

3 Answers3

5

As sha stated:

MyViewController *myViewController = [[MyViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myViewController];
[[self navigationController] presentModalViewController:navController animated:YES];
testing
  • 18,863
  • 44
  • 224
  • 396
  • 1
    `presentModalViewController` is deprecated as of iOS6. See http://stackoverflow.com/questions/12507455/a-lot-of-functions-are-deprecated-ios-6 – Mike Biglan MS Jan 03 '15 at 19:27
4

You can use a navigation controller as a modal view controller.

[parent presentModalViewController:myNavigationController animated:YES];
jtbandes
  • 110,948
  • 34
  • 232
  • 256
2

You create a UINavigrationController, then add UIViewController to it, then you present navigation controller with presentModalViewController

sha
  • 17,706
  • 5
  • 61
  • 98