Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UINavigationController's back button disappears?

I notice something strange happens to one of my view controller: the back button disappears, yet it's possible to go back to previous view controller by tapping the top left corner (i.e where the button should reside).

In my entire file there's no line that set self.navigationItem.hidesBackButton to YES; also NSLog prints 0 as self.navigationItem.hidesBackButton's value in viewDidLoad.

This occurs in both the simulator and real device. Any ideas?

like image 303
Anh Avatar asked May 28 '09 08:05

Anh


2 Answers

I had a recursive navigation controller, and this also happened to me, I used this code to fix it:

self.navigationItem.leftItemsSupplementBackButton = true
like image 140
Jeggy Avatar answered Nov 08 '22 23:11

Jeggy


Oh dear. In the implementation of the previous view controller, I accidentally set self.title to @"", which causes this annoying bug.

Remove this line solves the problem.

like image 27
Anh Avatar answered Nov 08 '22 23:11

Anh