views:

1003

answers:

2

I have a scenario where my UINavigationController is missing the back button (left button) but tapping the left button still seems to work.

I found a similar problem posted here: http://stackoverflow.com/questions/919832/uinavigationcontrollers-back-button-disappears which was resolved by not setting the title to @"", but that's not my problem. Are there any other scenarios that would cause this behaviour?

UPDATE:

In case it matters here is my view hierarchy: My MainWindow contains a UINavigationView which first loads a UIViewController (this view contains a Map). When tapping on an annotation accessory button it then loads a UITableViewController. It's this view that should have the back button.

Thanks.

A: 

Are you overriding the back button item -- not the same as the left button -- anywhere in your code? i.e.:

self.navigationItem.backBarButtonItem = ...

Are you setting the hidesBackButton property anywhere? i.e.:

self.navigationItem.hidesBackButton = YES;
Shaggy Frog
I'm not doing either in my code. I don't see anything in IB that looks suspicious either (though I may be overlooking it). In my view the leftBarButton and backBarButton are both nil. Early on in my project I did programmatically create another leftbarbutton but have since removed it and all reference to it. Could there still be some artifact left over that I can't see?
cagreen
+4  A: 

Oh Man! Ok, I found the answer here: http://www.iphonedevsdk.com/forum/iphone-sdk-development/35633-back-button-missing-navigation-bar.html

It turns out that my first view (the one with the map on it) didn't have a title set (in fact I hide the navigation bar because I didn't want to show it). Even if the title WAS set on a later view the SDK doesn't seem to care. I still don't understand 100% why I could tap in the area to get it to work.

So even though I hide the first navigation bar I still need to set the title of it.

That did it!

Thanks to everyone who tried to help.

cagreen