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
  • 19,681
  • 50
  • 236
  • 417
  • 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
  • 115,675
  • 35
  • 233
  • 266
2

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

sha
  • 17,824
  • 5
  • 63
  • 98