UIBarButtonItem has initWithCustomView.
So if you will create UIButton, then you can write something like:
UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:theUIBu
ttonYouCre
ated];
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.htmlActually this class has initWithImage too.