I have created a flexible navigation bar in my app that will show custom buttons on the left, right, and in the middle. So far I have got working:
- Right/Left/Middle - Custom Image and/or Text
- Right/Left - Normal looking button with custom Image in it
- Right/Left - Normal looking button with custom Text in it
By 'normal looking' I mean the default UIBarButtonItemStyle- just a nice shiny button.
My question is, how can I achieve the same look in the MIDDLE of the nav bar? I can do custom/text images by just creating a custom UIButton, and on the right / left I create a UIBarButtonItem from it, but in the middle I just add the UIButton view as a subview of the navbar.
I can't add a UIBarButtonItem to the navbar as a subview, and any UIButton I create doesn't look like a UIBarButtonItem.
The only workaround I can think of is to use a stretchable custom image that I steal from a screenshot. I'd rather avoid doing it this way. Am I missing something?
*********** UPDATE ************** The open source library Three20 will allow you to create UIButtons that look like UIBarButtonItems. Then you can add them to the bar view either by placing manually as a subview or by setting the title view.