1
votes

In the current version of Xcode a few things seems to work a bit different. I have a little problem working with a simple navigation. This is what I do:

  • I have a Storyboard with two scenes.
  • I connect the scenes with a segue of type "Show".
  • (In the past I did use "Push" but that is deprecated now.)
  • I select the first scene and choose "Embed in Navigation Controller.

Now both scenes will get a gray bar at the top but only the first scene will also get a Navigation Item. Only for the first scene I am able to edit a title attribute and only for the first scene I am able to add a Bar Button.

Navigation itself works fine. The title of the first scene is the text of the Back-button in the second scene.

Why has the second scene no Navigation Item?

Is it because of the segue type?

3

3 Answers

2
votes

Yeah, its a bug in Xcode from version 6. If you want Navigation Item in second view controller too, then there is a hack to get it.

Change the seque type from show to push. Now Navigation Item will appear in second VC too. You can again change the seque type from push to show, the Navigation Item will still present in second VC.

1
votes

IB will automatically add UINavigationItem to root view controller of your UINavigationController.

To the rest of your controllers in navigation flow you need to add UINavigationItem manually from IB Object library.

0
votes

What I do is to drag a navigation item from the list of controls to the top, gray bar on the second ViewController. Then you can drag other items such as bar buttons onto it, as well as being able to edit the title.