2

iOS14 introduced that long-press on back button which opens a callout menu to go back to specific VC in stack.

I would like to disable it, is there a possibility to do such a thing, and if yes how ?

Thanks

Cublax
  • 1,232
  • 1
  • 11
  • 20

1 Answers1

8

Try to set backButtonDisplayMode to .minimal on your VC ->

if #available(iOS 14.0, *) {
    navigationItem.backButtonDisplayMode = .minimal
}

https://developer.apple.com/documentation/uikit/uinavigationitem/3656350-backbuttondisplaymode

charlyatwork
  • 1,187
  • 8
  • 13
  • 3
    I upvoted but it actually doesn't work – Cublax Oct 16 '20 at 14:15
  • 5
    To elaborate on @charleyatwork's answer, if you have ended up with a blank menu because you were setting `title` or `backButtonTitle` to an empty string to have just the chevron icon, you can use this snippet but in an `else` block continue to set `backButtonTitle = ""` to get the best of both worlds. – chedabob Feb 09 '21 at 08:14
  • 2
    Yes, this works beautifully in iOS14, to replace the previous "hack" of setting the `backButtonTitle`. – Claus Jørgensen Mar 11 '21 at 10:23
  • Neither setting the `backButtonTitle` nor setting the `backButtonDisplayMode` actually works to suppress the menu. – matt Jun 09 '23 at 01:55