57

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?

sapi
  • 9,944
  • 8
  • 41
  • 71

2 Answers2

228

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

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • 7
    Yeah, what did you use to do that? It's the FUTURE! – jrturton Feb 14 '12 at 08:14
  • 22
    Snapz Pro X to record the screen (tho you can do it with QuickTime Player in Lion), then QuickTime Player 7 to export the movie as image files, then [GIFFun](http://www.stone.com/GIFfun/) to convert the image files to an animated GIF. – rob mayoff Feb 14 '12 at 08:36
  • 2
    That works for adding one left item bar, what if I need to add more items at the left of the navigation bar? – William Kinaan Jun 05 '14 at 14:20
  • If you want to create animated gif from screen capture then you can capture a portion of the screen using QuickTime and then convert the file using this web site: http://www.zamzar.com – Avi Cohen Jul 15 '14 at 04:19
  • These days I use (and recommend) [LICEcap](http://www.cockos.com/licecap/). It's free and saves directly to animated GIF. – rob mayoff Jul 15 '14 at 04:26
  • And for adding **multiple** buttons on either side, see http://stackoverflow.com/questions/9897978/cant-assign-multiple-buttons-to-uinavigationitem-when-using-storyboard-with-ios – Brian White Mar 14 '15 at 01:04
  • Licecap software records directly your screen to GIF without any conversion, just choose your record size area, choose your frame per seconds, and run it ! – AnthonyR Dec 22 '15 at 15:09
  • I've been using LICEcap for the last couple of years, unless I need to record the menu bar. – rob mayoff Dec 22 '15 at 17:01
30

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.

Ken Toh
  • 3,721
  • 1
  • 24
  • 30
  • Yes you are correct. Was wondering where on earth Navigation bar lol. – Jay Mayu Jun 15 '15 at 05:02
  • thank you for this - this is incredibly confusing. To reference Rob's .gif, you drag a "navigation item" onto the same area as he shows dragging the bar button item. Then, you drag the bar button item there afterwards. – manroe Jun 14 '16 at 20:07