Adding buttons to navigation controllers

2019-09-19 10:14发布

问题:

I am working in a swift 3 xcode 8 project, and I have an issue.

I have some view controllers. In the first one I've inserted a navigation controller, which gives me the "back" button when I am in another view controller. So I can go on and back to the first viewcontroller.

The thing is, lets say, when I am in the third view controller I'd like to insert a button, but appearing just in this viewcontroller in the navigation controller.

I've tried adding a bar button item but it doesnt work because the navigation controller only appears, in the storyboard, in my first viewcontroller.

So how can I add buttons to the navigation controller, in another viewcontrollerS?

回答1:

So how can I add buttons to the navigation controller, in another viewcontrollerS

Drag a Navigation Item into your third view controller. Now you can add bar button items to that.