Search code examples
iosuiviewcontrolleruinavigationitem

Navigation Bar on Modal View Controller


I have a view controller that executed by a modal view (no Navigation Controller connected). I want to have a Navigation Bar on top and be able to change the buttons and title dynamically depending on what the user has selected on the view controller.

I have read that you can set the View Controllers Simulated Metrics to include either a Translucent or Opaque Navigation Bar.

However, after I select this and add a navigation item to it, I can't get it to show the buttons or title and also don't know how to reference it in code.

Can anyone help walk me through it?


Solution

  • Simulated metrics are a design aid to help in laying out your views; the navigation bar you add that way isn't actually added to your controller at run time. You need to drag out a navigation bar from the object list, and add it to your controller's view.