0

So my app has been doing the following piece of code on the didFinishLaunchingWithOptions method on the AppDelegate to hide the back button text on navigation bar:

let itemAppearance = UIBarButtonItem.appearance()
    itemAppearance.setBackButtonTitlePositionAdjustment(UIOffset(horizontal: -200, vertical: 0), for: UIBarMetrics.default)

To my surprise, among other things which I already solved (such as this), the above code no longer works on iOS 15 & XCode 13.

Ive been searching alternatives such as:

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

Which seem to be working just fine, however this works on a specific ViewController and Id like this to work App-Wide, having to run this code on every VC is annoying.

I tried to run the above code on the same app delegate method, but sadly I dont have access to navigationItem on AppDelegate.

Any tip is welcomed, thanks!

PD: Ideally this would need to support all the way back to iOS 13.

stompy
  • 227
  • 1
  • 13
  • Does this answer your question? [Show/Hide barButtonItem](https://stackoverflow.com/questions/32553197/show-hide-barbuttonitem) – stackich Jan 02 '22 at 21:11
  • Hmm I dont think it does, if Im not mistaken that deals with the actual UIBarButtonItem icon, not the text attached to it. Plus the answers all point to a per-VC solution, I need to disable the back button text app-wide. – stompy Jan 03 '22 at 16:45

0 Answers0