How to put a view on the back button of navigation bar?

privateson
privateson used Ask the Experts™
on
Hey guys, I am wondering how to put a view on the back button of navigation bar?
Not on title view, but on the back button.
It seems like to me that the back button is a UIBarButtonItem, which doesn't inherite UIView...
Help please!

Thanks!

David
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
UIBarButtonItem has initWithCustomView.
So if you will create UIButton, then you can write something like:
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:theUIButtonYouCreated];

http://developer.apple.com/iphone/library/documentation/uikit/reference/UIBarButtonItem_Class/Reference/Reference.html#//apple_ref/occ/instm/UIBarButtonItem/initWithCustomView:

Here you will see a short example:
How to use a custom UIBarButtonItem to display a UIActivityIndicatorView
http://www.leegillen.com/Public/Blog/Entries/2008/10/26_How_to_use_a_custom_UIBarButtonItem_to_display_a_UIActivityIndicatorView.html

Actually this class has initWithImage too.
Commented:
you can either use apple's api for [[UIBarButtonItem alloc] initWithCustomView: aView];
or three20's library
TTButton *aButton = [TTButton buttonWithStyle:@"toolbarBackButton" title:@"back"];
and then add a subview on top of that button.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial