I have spent the better part of few hours a day for a week trying to implement a custom backBarButtonItem. Just curious if anyone has a solution for doing this. My designer choose a great tint color for the UINavigationBar and even some cool buttons to go along with it, and I haven't figured out how to use them. Using the standard buttons (normal/edit/save/done/etc) can leave it with some horrible color choices based on tintColor.
I am not looking at making a custom button and setting it as the leftBarButtonItem, then hiding the backBarButtonItem. This doesn't provide the animation of the back button sliding and changing alpha, and I feel is a bit hackish. Here is what I have tried so far.
1) While you can create custom backBarButtonItem with UIBarButtonItem, it disregards the customView that you can set on it.
2) Overriding the addSubview: and insertSubview:atIndex: methods on UINavigationBar will let you see that subviews of (private) class UINavigationItemButtonView are being added. Searching Google will get you some header information, it's a UIView subclass. You can add subviews, or sublayers to it all you want but you do not get any notification of it being pressed to show your pressed images. This is probably handled by the UINavigationBar as it a UIResponder subclass. In fact you can even hide the subviews then click on the UINavigationBar itself and it will respond accordingly.
3) There is a probably private method you can override on the UINavigationBar.
PHP Code:
-(void)drawBackButtonBackgroundInRect:(CGRect)rect withStyle:(int)style pressed:(BOOL)pressed;
Works great and is exactly what I need, but I'm afraid of being rejected by Apple for using it, or worse slipped by then rejected later.
If anyone has any suggestions it would be greatly appreciated.