0

To hide the back button on iOS, we generally write:

self.navigationController?.navigationBar.topItem?.backBarButtonItem = nil

or

self.navigationController?.navigationItem.leftBarButtonItem = nil

or

self.navigationController?.navigationItem.backBarButtonItem = nil

or

self.navigationItem.setHidesBackButton(true, animated: true)

None of the above statements works in my case i.e. iOS 11.4.

Is this any known bug in iOS 11.4 version or I am doing anything wrong?

Mojtaba Hosseini
  • 95,414
  • 31
  • 268
  • 278
pkc456
  • 8,350
  • 38
  • 53
  • 109
  • Does this answer your question? [How to hide 'Back' button on navigation bar on iPhone?](https://stackoverflow.com/questions/614212/how-to-hide-back-button-on-navigation-bar-on-iphone) – emmics Feb 17 '20 at 13:58

3 Answers3

0

Try self.navigationController?.navigationBar.topItem?.leftBarButtonItem = nil

It works for me in iOS 11.4 and iOS 13.1

AlexSmet
  • 2,141
  • 1
  • 13
  • 18
0

First make a Outlet like this @IBOutlet var naviBar: UINavigationItem!

Then try this self.naviBar.hidesBackButton = true

Worked for me...!

Nicol Vishan
  • 63
  • 1
  • 10
0

Try this

 self.navigationController?.navigationItem.hidesBackButton = true
Atmaram
  • 494
  • 4
  • 14