Embedding view controllers in navigation controllers

As you saw in the app tour, many screens have a navigation bar at the top of the screen. To get this, you will embed the view controller of the Explore and Map scenes in a navigation controller. This will make navigation bars appear at the top of the screen when the Explore and Map screens are displayed:

  1. Click Explore Scene in the document outline:

  1. Choose Editor | Embed In | Navigation Controller:

  1. A Navigation Controller Scene appears between the Tab Bar Controller Scene and the Explore Scene:


  1. Build and run your app. Note that the Explore screen now has a navigation bar:

Embedding a view controller in a navigation controller adds that view controller to the navigation controller's viewControllers array. The navigation controller then displays the view controller's view on the screen. The navigation controller also displays a navigation bar at the top of the screen. If you tap the Map button in the Tab Bar, you'll see the Map screen does not have a navigation bar yet.

  1. Click Map Scene in the document outline:

  1. Choose Editor | Embed In | Navigation Controller:

  1. A Navigation Controller Scene appears between the Tab Bar Controller Scene and the Map View Controller Scene:

Build and run your app. Both screens now have a navigation bar:

The Tab Bar buttons can switch between the Explore and Map screens, and each screen now has a navigation bar. The button titles are correct but the buttons themselves do not have icons. To get the button icons, you will add a file containing all of the graphics assets required for your project in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.16.184