Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide Navigation Controller Back Button iOS 7

I have tried to hide the back button in my navigation controller by adding the following lines to my viewDidLoad method. Many other previous answers on SO have said this works, so I don't know what my problem is? Maybe something new with iOS 7 / Xcode 5?

self.navigationItem.hidesBackButton = YES;
self.navigationController.navigationItem.hidesBackButton = YES;
like image 840
Adam Johns Avatar asked Nov 19 '13 05:11

Adam Johns


People also ask

How do I get rid of the back button on my iPhone?

Yes, the back button can be disabled. Please navigate to Advanced Website Kiosk Settings–>Navigation–>Disable back button. Kindly enable this restriction to disallow the usage of the back button on the iOS device.

How do I change the navigation bar on my iPhone?

A user changes the navigation bar's style, or UIBarStyle , by tapping the “Style” button to the left of the main page. This button opens an action sheet where users can change the background's appearance to default, black-opaque, or black- translucent.

How do I show the back button in Swift?

Back-button text is taken from parent view-controller's navigation item title. So whatever you set on previous view-controller's navigation item title, will be shown on current view controller's back button text. You can just put "" as navigation item title in parent view-controller's viewWillAppear method.


2 Answers

I too had faced similar issue. This will work only when you have not customized your Navigation bar. Either one of the below one will work.

[self.navigationItem setHidesBackButton:YES animated:YES];   OR
[self.navigationItem setHidesBackButton:YES];

Please check whether your getting "Back" in iOS 7, then the above will work.

Hope this will help you to identify the issue

like image 190
Nattudurai Avatar answered Oct 05 '22 23:10

Nattudurai


In UINavigationController we can hide Like this:

[self.navigationItem setHidesBackButton:YES animated:YES];

And In UITabBarController we can Hide Like this:

self.tabBarController.navigationItem.hidesBackButton = YES;
like image 24
Nag Raj Avatar answered Oct 05 '22 23:10

Nag Raj