views:

21

answers:

1

I have a splitViewController and I would like to add a couple of buttons to the navigation bar for certain details views - is this possible? Looking at the API I only see a leftNavbarItem and a rightNavBarItem.

+2  A: 

If you create a UIToolBar, add your buttons to it, and then make it your leftNavBarItem or rightNavBarItem, the navigation bar is smart enough to make the buttons appear as though they're sitting on the navigation bar. So you get the illusion of having multiple button items when they are in fact part of a toolbar.

Also, I'd advise against using UIButton and use UIBarButtonItem instead. Bar button items are designed to look "right" when sitting on a navigation bar or toolbar. I'd steer clear of UIButton unless you need a custom look, and even then it needs to be embedded in a UIBarButtonItem as a custom view.

Alex
Huh, I never knew that! Thanks! Don't your buttons get pretty crowded?
Steve
In an iPad app, there's usually room for two or three icon buttons on a side, or two text buttons. Any more than that and it probably will get pretty crowded.
Alex