0

Code:

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

Back button is not getting hidden.

Also tried:

self.navigationController!.navigationItem.setHidesBackButton(true, animated: false)

in the viewDidLoad() method. But it is not working. Why does this not work?

shaik moeed
  • 5,300
  • 1
  • 18
  • 54
John Doe
  • 2,225
  • 6
  • 16
  • 44

1 Answers1

2

Try this, it works for me:

self.navigationItem.leftBarButtonItem = nil
self.navigationItem.setHidesBackButton(true, animated: false)

Hope this helps.

qtngo
  • 1,594
  • 1
  • 11
  • 13
  • 1
    This is the correct answer, you set the properties on the ViewController's navigationItem and not directly on the NavigationController – Macistador Feb 10 '19 at 17:22