Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationController Back Button not visible, but works

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: UINavigationController's 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.

like image 664
cagreen Avatar asked Mar 21 '10 02:03

cagreen


2 Answers

Oh Man! Ok, I found the answer in an article on iphonedevsdk.com, now defunct.

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.

like image 89
cagreen Avatar answered Oct 22 '22 10:10

cagreen


Other than the suggestions provided above. changing the Appearance of Navigation bar can also make Back button invisible.

UINavigationBar.appearance().tintColor = UIColor.white

Verify if you are not setting this tint color to something which blend with the background.

like image 21
soan saini Avatar answered Oct 22 '22 11:10

soan saini