How to remove all navigationbar back button title
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
When developing an iOS application, achieving a seamless user experience often involves minor UI adjustments, such as removing the back button title from the navigation bar. By default, when you push a new view controller onto your navigation stack, the back button retains the title of the previous view controller. However, there may be occasions when you want a cleaner look by removing this title entirely.
This article provides a comprehensive guide on how to remove the navigation bar back button title with detailed technical explanations and code examples.
Why Remove the Back Button Title?
- Aesthetic Cleanliness: A back button without a title can give your interface a minimalistic look, which can be especially important for apps that emphasize simplicity in design.
- Space Management: When space is limited, removing the back button title can prevent overlapping and maintain a clean layout.
- Consistency Across Languages: If your app supports multiple languages, back button titles can vary in length, which might affect your layout consistency.
Methods to Remove the Navigation Bar Back Button Title
Several approaches can be employed to achieve this objective, depending on your specific needs or preferences. Below are the methods in detail:
1. Setting a Custom Back Button Programmatically
To completely remove the back button title, set a custom `UIBarButtonItem` with an empty title in your `UIViewController` subclass:
- Explanation: In this snippet, we create a `UIBarButtonItem` with an empty string as its title and assign it to `backBarButtonItem` of `navigationItem`. This effectively removes the title from the back button when navigating from this view controller.
- Explanation: This approach configures the navigation bar's appearance globally across the app, ensuring that each navigation controller utilizes a back button with no title by default.
- Explanation: Here, we override the `pushViewController` method to ensure that whenever a new view controller is pushed onto the stack, its `backBarButtonItem` is set to an item with an empty title.
- Navigation Stack Management: Removing back button titles should be done with consideration for how users navigate your app to ensure the UI remains intuitive.
- Accessibility Compliance: Enhancements such as removing text should be balanced with accessibility needs to avoid confusing users relying on assistive technologies such as VoiceOver.
- Memory & Performance: Modifying UI elements heavily or globally can sometimes affect application performance. Ensure these methods are used efficiently.

