As the title suggests, I would like to know if it is possible to avoid adding right bar button in the navigation bar through code.
I've done the usual process with a view controller embedded in a navigation controller and trying to drop the bar button item inside the navigation bar of the view controller, but it no longer works for some reasons.
So is it possible to be done in the storyboard somehow in iOS 8?
Xcode ver. 6.2 Stable
Go to the Storyboard. Select the View Controller and in The Editor menu select Embed in -> Navigation Controller. Next, drag a Bar Button from the Object Library to the left side of the Navigation Bar and name it "Left Item". Repeat this for the right side and name it "Right Item".
Under the View menu, select Utilities→Show Object Library. In the Object Library, find the Navigation Controller object (see Figure 4-7) and drag and drop it into the storyboard, to the left side of your existing view controller (Figure 4-6).
Well, it seems there is a problem with the differences between new segues introduced in iOS 8 and the old ones. In this case it is the difference between push
segues which allows adding a right bar button in storyboard and show
segue which if added automatically (dragging from a controller to another) does not allow dropping the button in the navigation bar.
The reason is when using the old segues, the controller would automatically be given a navigation bar, thus you can add elements to it, while if using the new segues the navigation bar is not automatically added to the controller in the storyboard.
What solved this issue for me was:
push
segueshow
segueResult: Now I can add as always the right bar button item through Storyboard.
if you want to add BarButtonItem to not RootViewController you must first add Navigation Item to your ViewController.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With