H.N. H.N. - 1 month ago 5
iOS Question

Adding buttons to navigation controllers

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?

Answer

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.