20
votes

There are 2 View Controllers in my storyboard, VC_A and VC_B

I have embeded a navigation controller in VC_A which is a Table View Controller, I then control drag the Prototype Cell into VC_B to create a segue. If I select "show" in "selection segue" then in VC_B I can see the outline of the navigation bar but I am unable to select it or add any bar buttons to it, it also doesn't appear in the hierarchical view.

view

However if I select the "push (deprecated)" option when choosing the type of segue, I am able to select the navigation bar in VC_B and add buttons to it, it also show up in the hierarchical view as a Navigation Item.

The only work around I can find is to choose show, then change the segue to push(deprecated) in the Attribute Inspector so the Navigation Item will show up in the hierarchical view, then change the segue back to show. But I am worry that this might cause problems further down the line.

Is there a way to add a Bar Button to VC_B's navigation bar without using the work around?

5
Running into the same issue. Don't have a work-around. Although you can just start with push(deprecated) and then go to show.dar512

5 Answers

13
votes

Just drag the "Navigation Item" from object library to the navigation bar and it should work as expected. You can make changes as you like and it works exactly like in Xcode 5.

6
votes

Interestingly, when you first time made the connection b/w your table view controller and view controller using Push you can start editing the navigation bar without a problem (e.g put bar items onto it).

Then delete the connection between your table view controller and view controller (but do not delete the nav bar items you just added), then re-connect the two controllers by using segue Show, you will see the navigation bar works just like segue Push now.

Hope it helps

6
votes

I think the way you do it (going through the deprecated push) is not wrong even though there's another way. In fact, when you turn the Segue into a push, you get a Navigation Item out of it.

So all you have to do is add a Navigation Item to your View Controller and that'll do the trick:

enter image description here

5
votes

This seems Xcode bugs.

In my case, i am re-create segue by this sequence:

  1. Delete existing seque. (I am using "Action segue - Show")
  2. Drag new segue with "Non-Adaptive Action Segue - Push (deprecated)"
  3. Delete segue no.2
  4. Re-create/connect "Action Seque - Show". (No.1)
  5. Done

Now, i can edit navigation title and add custom navigation item button as usually.

I am using Xcode 6.4, and minimal target iOS version 7.

3
votes

In your viewController :

self.navigationItem.title = "Second VC"
self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Play, target: self, action: "playFunction:")

enter image description here