Can you add buttons to navigation bars through storyboard?

Ios

Ios Problem Overview


At the moment, I've been adding navigation buttons like follows:

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Add"
                                                                          style:self.editButtonItem.style 
                                                                         target:self
                                                                         action:@selector(doneButtonPressed)];

It seems a bit silly to not add them through storyboard, but I can't find a way to do so. Is there one that I'm missing?

Ios Solutions


Solution 1 - Ios

You can just drag out a Bar Button Item and drop it on the right end of the view controller's navigation bar:

enter image description here

Solution 2 - Ios

As of Xcode 6, it looks like the navigation item on the navigation bar is no longer created automatically.

You'll need to drag out a Navigation Item onto the navigation bar first before you can drag out a Bar Button Item (as detailed in Rob's answer) to add to the navigation item.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionsapiView Question on Stackoverflow
Solution 1 - Iosrob mayoffView Answer on Stackoverflow
Solution 2 - IosKen TohView Answer on Stackoverflow