Unable to add the "Bar" button to the second page through the "Interface"

My application has two pages, so in the interface designer I have three controllers:

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

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

Tried to do the same in TableViewController2 and it will not drop the panel button.

I have the “Shows Navigation Bar” attribute set in the navigation controller and I see the space for the navigation bar in TableViewController2, but I don’t see the same “navigation element” in the component hierarchy that I see for TableViewController1.

If I drag the panel button onto the controller itself, it places a new NavigationItem icon on the controller (between the first responder and the output), and this looks promising, but it does not appear when the application starts.

+5
source share
1 answer

For this, TableViewController2 you need to explicitly add the navigation element to xib, and then you can add panel elements on it. enter image description here

In xib it will look like this, you can set the title and button. enter image description here

+18
source

Source: https://habr.com/ru/post/1210566/


All Articles