
- iOS Tutorial
- iOS - Home
- iOS - Getting Started
- iOS - Environment Setup
- iOS - Objective-C Basics
- iOS - First iPhone Application
- iOS - Actions and Outlets
- iOS - Delegates
- iOS - UI Elements
- iOS - Accelerometer
- iOS - Universal Applications
- iOS - Camera Management
- iOS - Location Handling
- iOS - SQLite Database
- iOS - Sending Email
- iOS - Audio & Video
- iOS - File Handling
- iOS - Accessing Maps
- iOS - In-App Purchase
- iOS - iAd Integration
- iOS - GameKit
- iOS - Storyboards
- iOS - Auto Layouts
- iOS - Twitter & Facebook
- iOS - Memory Management
- iOS - Application Debugging
- iOS Useful Resources
- iOS - Quick Guide
- iOS - Useful Resources
- iOS - Discussion
How to hide Back Button on navigation bar on iPhone/iPad?
To hide the back button on navigation bar we’ll have to either set the navigation button as nil and then hide it or hide it directly.
Let’s create a project, add 2 view controller and Embed them in navigation controller. Let’s see how this project looks when run without any code to remove the navigation bar.
This code set’s the navigation bar’s back button as hidden.
self.navigationController?.navigationItem.hidesBackButton = true
This code set’s the navigation bar’s back button as nil
self.navigationItem.leftBarButtonItem = nil;
A combination of these to approaches would be a better solution and works even if you have set a custom navigation bar.
self.navigationItem.leftBarButtonItem = nil self.navigationItem.hidesBackButton = true
You can also use
override func viewDidLoad() { super.viewDidLoad() self.navigationItem.setHidesBackButton(true, animated: false) }
Let’s see how the app looks after adding the above code to new view controller.
Note − Do not forget to assign class to the Second View controller and add the above code in that class.
- Related Articles
- How to create a left-arrow button on a Toolbar on iPhone/iPad?
- HTML5 inline video on iPhone vs iPad/Browser
- How to permanently hide Navigation Bar in an Android Activity?
- How to enable back button in action bar?
- How to hide a div in JavaScript on button click?
- How to Hide the Like and Dislike Button on YouTube
- How to enable back button action in action bar?
- How to Create an On Scroll Fixed Navigation Bar with CSS?
- How to hide a navigation menu on scroll down with CSS and JavaScript?
- How to Debug JavaScript on iPad?
- How to permanently hide the Navigation Bar in an Android activity using Kotlin?
- How to resize a navigation bar on scroll with CSS and JavaScript?
- How can I change the text color of the Navigation Bar on iOS?
- How to go through all text fields with the "Next" Button on the iPhone/iOS Keyboard?
- How to generate Unique ID of device for iPhone/iPad using Swift?

Advertisements