Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide 'Back' button on navigation bar on iPhone?

I added a navigation control to switch between views in my app. But some of the views shouldn't have 'Back' (the previous title) button. Any ideas about how to hide the back button?

like image 715
Chilly Zhong Avatar asked Mar 05 '09 10:03

Chilly Zhong


People also ask

How do I hide the back button on my navigation?

Way 1: Touch “Settings” -> “Display” -> “Navigation bar” -> “Buttons” -> “Button layout”. Choose the pattern in “Hide navigation bar” -> When the app opens, the navigation bar will be automatically hidden and you can swipe up from the bottom corner of the screen to show it.

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 hide Navigation bar on iPhone?

Go to Settings > Accessibility > Guided Access and toggle on Guided Access. Open an app and triple-click the Power button to enter Guided Access. There's no other way to get rid of the Home Bar.

How do I hide the right bar button in Swift?

In swift 4 I has a trick to show / hide right or left button: Step 1: Create a IBOutlet button in view controller: @IBOutlet var navigationItemButton: UIBarButtonItem! Step 4: Just call the functions that you want, use hideNavigationButton() to hide, and showNavigationButton() to show the button.


2 Answers

Objective-C:
self.navigationItem.hidesBackButton = YES;

Swift:
navigationItem.hidesBackButton = true

like image 138
user8170 Avatar answered Oct 23 '22 14:10

user8170


The best way is to combine these, so it will hide the back button even if you set it up manually :

self.navigationItem.leftBarButtonItem=nil; self.navigationItem.hidesBackButton=YES; 
like image 40
Skrew Avatar answered Oct 23 '22 14:10

Skrew