Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add multiple UIBarButtonItems to UINavigationItem in Storyboard?

Tags:

iphone

ipad

ios5

enter image description here

It is easy to add a single UIBarButton item as you can see here in my Storyboard. But I want to add several and it seems I cannot using the Storyboard?

Which is annoying because then I lose the whole nice overview of the Storyboard and it's Segue's.

Is this the case? First project using Storyboards so I figured I might be missing something.

like image 392
Slee Avatar asked Jun 01 '12 18:06

Slee


2 Answers

In XCode 4.6 (at least), you can drag a plain view onto the navigation bar (on whichever side you want multiple buttons), then drag a toolbar on top of that. Once you've done that, you can place multiple bar button items on the toolbar, and wire them up to actions / segues, etc, as normal. Make sure you have the view and toolbar both set up for default (transparent) background color.

like image 76
Dan L Avatar answered Nov 20 '22 04:11

Dan L


In Xcode 7 you can finally just drag multiple UIBarButtonItems to the UINavigationItem directly in Interface Builder.

See WWDC 2015 Session 407 video titled:

Implementing UI Designs in Interface Builder

https://developer.apple.com/videos/wwdc/2015/?id=407

like image 21
Daniel Avatar answered Nov 20 '22 02:11

Daniel