Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot add Bar Button to Second Page through Interface Builder

My App has two pages, so in interface builder I have three controllers:

  • A NavigationController
  • segues via RootViewController to TableViewController1
  • segues via push to TableViewController2

I easily added a Bar Button to the right side of the navigation bar of TableViewController1 by dragging it from the tools.

Tried to do the same thing in TableViewController2 and it won't drop the bar button.

I have the "Shows Navigation Bar" attribute checked on the Navigation Controller and I can see a space for the navigation bar on TableViewController2, but I don't see the same "Navigation Item" in the component hierarchy that I see for TableViewController1.

If I drag a bar button to the controller itself it puts a new NavigationItem icon on the controller (between First Responder and Exit) and that looks promising, but it doesn't show when I run the app.

like image 709
Robert Antonucci Avatar asked Jan 07 '15 14:01

Robert Antonucci


1 Answers

For this TableViewController2, you have to explicitly add a navigation item into the xib and then you can add bar button items on it.enter image description here

It will look like this in xib , you can set title and button.enter image description here

like image 138
NewStackUser Avatar answered Nov 12 '22 03:11

NewStackUser