0

I have added the following code to hide the back button title on the navigation bar but it is not working on iOS 15.

UIBarButtonItem.appearance().setBackButtonTitlePositionAdjustment(UIOffset(horizontal: -1000, vertical: 0),
                                                                      for: UIBarMetrics.default)

can someone help me plz?

Pranjali Wagh
  • 338
  • 1
  • 3
  • 14
  • Does this answer your question? [How can I hide the navigation back button in SwiftUI?](https://stackoverflow.com/questions/57112026/how-can-i-hide-the-navigation-back-button-in-swiftui) – LoVo Feb 16 '22 at 08:35
  • No, it's for swift UI my code is in swift. – Pranjali Wagh Feb 16 '22 at 08:38
  • Does this answer your question? [How to remove all navigationbar back button title](https://stackoverflow.com/questions/29912489/how-to-remove-all-navigationbar-back-button-title) – Claudio Feb 16 '22 at 09:06

2 Answers2

1

You will want to do this on your navigation bar button:

 navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)

The title will need to be an empty string and that gets rid of the title.

Ralph Lee
  • 87
  • 2
  • 9
0

I have resolve this by using following method :

let appearance = UINavigationBarAppearance()    
appearance.backButtonAppearance.normal.titlePositionAdjustment = UIOffset(horizontal: -1000, vertical: 0)
Pranjali Wagh
  • 338
  • 1
  • 3
  • 14