Modal segue, navigation bar disappears Modal segue, navigation bar disappears ios ios

Modal segue, navigation bar disappears


Just add another Navigation Controller to your modal view controller. Follow the steps

  1. Select the Modal View Controller
  2. Go to Editor menu
  3. Select Embed In
  4. Select Navigation Controller

Run the application. Now it should work perfectly.

Hope this solves your problem.


Modal segues take over the whole screen, so any navigation bars, tool bars, or tab bars that are in the presenting controller will be covered up. If you want a navigation bar on this modal controller, you'll need to add one specifically to it, and add any buttons you want to that new navigation bar (or tool bar). If you don't want to do this, then don't present it modally, do a push to it.


You could simply do the following to show the navigation bar:

Objective-C

UINavigationController alloc]initWithRootViewController:modalVC];

SWIFT 3

let modelVC = self.storyboard?.instantiateViewController(withIdentifier: "modalVC") as! ModalVClet navBarOnModal: UINavigationController = UINavigationController(rootViewController: modalVC)self.present(navBarOnModal, animated: true, completion: nil)

This will show the modal view controller with the navigation bar. Knowledge on Objective-C is limited, so I did not write the part of presenting. You should be able to figure that one out. ;)

Hope this helps!