presentViewController and displaying navigation bar
It is true that if you present a view controller modally on the iPhone, it will always be presented full screen no matter how you present it on the top view controller of a navigation controller or any other way around. But you can always show the navigation bar with the following workaround way:
Rather than presenting that view controller modally present a navigation controller modally with its root view controller set as the view controller you want:
MyViewController *myViewController = [[MyViewController alloc] initWithNibName:nil bundle:nil];
UINavigationController *navigationController =
[[UINavigationController alloc] initWithRootViewController:myViewController];
//now present this navigation controller modally
[self presentViewController:navigationController
animated:YES
completion:^{
}];
You should see a navigation bar when your view is presented modally.
Can you use:
[self.navigationController pushViewController:controller animated:YES];
Going back (I think):
[self.navigationController popToRootViewControllerAnimated:YES];
Swift 5.*
Navigation:
guard let myVC = self.storyboard?.instantiateViewController(withIdentifier: "MyViewController") else { return }
let navController = UINavigationController(rootViewController: myVC)
self.navigationController?.present(navController, animated: true, completion: nil)
Going Back:
self.dismiss(animated: true, completion: nil)
Swift 2.0
Navigation:
let myVC = self.storyboard?.instantiateViewControllerWithIdentifier("MyViewController");
let navController = UINavigationController(rootViewController: myVC!)
self.navigationController?.presentViewController(navController, animated: true, completion: nil)
Going Back:
self.dismissViewControllerAnimated(true, completion: nil)