UINavigationBar
iOS Development
Back Button
Swift Programming
User Interface

UINavigationBar Hide back Button Text

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Hiding the text next to the back chevron is a common UIKit customization when you want a cleaner navigation bar. The detail that trips people up is that the back button belongs to the previous view controller, so the correct fix is often applied one screen earlier than expected.

How The Back Button Title Is Chosen

When a navigation controller pushes DetailViewController, the back button shown there is usually derived from the navigationItem of the previous controller. In other words, if ListViewController pushes DetailViewController, the back button text seen on the detail screen is configured from ListViewController.

That is why this code belongs in the previous controller:

swift
1import UIKit
2
3final class ListViewController: UIViewController {
4    override func viewDidLoad() {
5        super.viewDidLoad()
6        navigationItem.backButtonTitle = ""
7    }
8}

On iOS 14 and later, that is the simplest per-screen solution.

Using backButtonDisplayMode

If you want the chevron only, backButtonDisplayMode is even clearer:

swift
1import UIKit
2
3final class ListViewController: UIViewController {
4    override func viewDidLoad() {
5        super.viewDidLoad()
6        navigationItem.backButtonDisplayMode = .minimal
7    }
8}

.minimal hides the text while preserving the standard back behavior and swipe gesture. In most modern apps, this is preferable to building a custom button.

Supporting Older iOS Versions

For older deployment targets, set a custom backBarButtonItem with an empty title:

swift
1import UIKit
2
3final class ListViewController: UIViewController {
4    override func viewDidLoad() {
5        super.viewDidLoad()
6        navigationItem.backBarButtonItem = UIBarButtonItem(
7            title: "",
8            style: .plain,
9            target: nil,
10            action: nil
11        )
12    }
13}

Because the target and action are nil, UIKit still provides the normal pop behavior. You are only changing the title that the next screen will display.

Applying It Across The App

If the entire app should hide back button text, configure appearance once:

swift
1import UIKit
2
3@main
4final class AppDelegate: UIResponder, UIApplicationDelegate {
5    func application(
6        _ application: UIApplication,
7        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
8    ) -> Bool {
9        let appearance = UIBarButtonItemAppearance()
10        appearance.normal.titleTextAttributes = [.foregroundColor: UIColor.clear]
11
12        let navAppearance = UINavigationBarAppearance()
13        navAppearance.configureWithDefaultBackground()
14        navAppearance.backButtonAppearance = appearance
15
16        UINavigationBar.appearance().standardAppearance = navAppearance
17        UINavigationBar.appearance().scrollEdgeAppearance = navAppearance
18        UINavigationBar.appearance().compactAppearance = navAppearance
19
20        return true
21    }
22}

This approach gives consistent behavior, but it is broader than a per-screen fix. Use it only when the design system truly wants the back title hidden everywhere.

Why A Custom Left Bar Button Is Usually The Wrong Fix

Many examples on the internet replace the back button with a custom leftBarButtonItem. That works visually, but it also disables default behaviors unless you rebuild them yourself. The interactive swipe-to-go-back gesture is especially easy to lose.

A custom button should be reserved for cases where you want different behavior, not just a hidden label:

swift
1navigationItem.hidesBackButton = true
2navigationItem.leftBarButtonItem = UIBarButtonItem(
3    image: UIImage(systemName: "chevron.left"),
4    style: .plain,
5    target: self,
6    action: #selector(goBack)
7)

This is more maintenance, so avoid it unless the standard back button cannot meet the requirement.

Common Pitfalls

The biggest mistake is setting the back title on the current view controller instead of the previous one. If the title is wrong on DetailViewController, look at the controller that pushed it.

Another pitfall is confusing hidesBackButton with hiding the back text. hidesBackButton removes the entire button, not just the label.

Developers also often use a custom left button when .minimal, backButtonTitle, or backBarButtonItem would have preserved native behavior with less code.

Finally, test large titles and different OS versions. Navigation appearance APIs changed over time, and app-wide styling can interact with individual controller settings in unexpected ways.

Summary

  • The displayed back button is usually configured from the previous view controller.
  • On iOS 14 and later, backButtonDisplayMode = .minimal is the cleanest option.
  • 'navigationItem.backButtonTitle = "" also works for per-screen customization.'
  • For older targets, use an empty backBarButtonItem.
  • Avoid custom back buttons unless you need custom behavior, not just hidden text.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.