0

I have two different UIStorboards and I am using a UINavigationController to load the pages.

I have a total of three UIViewControllers. Two of them are on the first UIStoryboard and the third one is on the second UIStoryboard.

1) Navigation controller

2) Main Controller

3) Value Screen Controller.

I want to add right button on navigation bar only when value screen controller get loaded. It should not be available on Main view controller. I tried with this solution but not worked.

Community
  • 1
  • 1
Nick
  • 1,127
  • 2
  • 15
  • 40

1 Answers1

1

Each UIViewController has its own UINavigationItems. So you can just add this right button in your Value Screen Controller by adding this line:

self.navigationItem.rightBarButtonItem = UIBarButtonItem(barButtonSystemItem: <#T##UIBarButtonSystemItem#>, target: <#T##Any?#>, action: <#T##Selector?#>)

You can place it in func viewDidLoad() if you want it to be place as soon as the UIViewController's view is loaded.

Rici
  • 1,014
  • 2
  • 12
  • 21