Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation Bar not selectable in Show Segue, Xcode 6.1

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?

like image 922
NameTaken Avatar asked Sep 17 '14 18:09

NameTaken


3 Answers

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.

like image 196
Sai Jithendra Avatar answered Nov 05 '22 21:11

Sai Jithendra


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

like image 6
Venzentx Avatar answered Nov 05 '22 21:11

Venzentx


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

like image 6
Snaker Avatar answered Nov 05 '22 20:11

Snaker