UINavigationBar Hide back Button Text
Interview Questions practice on Codemia
Over 8,000 real interview questions from top companies, searchable by company and role.
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:
On iOS 14 and later, that is the simplest per-screen solution.
Using backButtonDisplayMode
If you want the chevron only, backButtonDisplayMode is even clearer:
.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:
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:
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:
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 = .minimalis 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
- UINavigationController back button custom text?
- UINavigationController without navigation bar?
- UIPageViewController return the current visible view
- UIPanGestureRecognizer - Only vertical or horizontal
- UIPopovercontroller dealloc reached while popover is still visible
- UIRefreshControl - beginRefreshing not working when UITableViewController is inside UINavigationController
- UIRefreshControl on UICollectionView only works if the collection fills the height of the container
- UIRefreshControl without UITableViewController
.png&w=3840&q=75)
Tackling System Design Interview Problems
A short course that equips you with the skills to approach system design interviews methodically.
Start the free courseTrack 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.