2

Here's a fragment of my Storyboard: enter image description here

As there is a NavigationController at the very beginning, a default back button is displayed into each view controller and this is right. But I would like that back button not to be displayed in the Login screen show and in the home one. So in the LoginViewController class I wrote this:

override func viewWillAppear(animated: Bool) {
    self.navigationItem.setHidesBackButton(true, animated: true)
    ...
}

and it works perfectly. I did the same thing into HomeViewController class:

override func viewWillAppear(animated: Bool) {
    self.navigationItem.setHidesBackButton(true, animated: true)
    ...
}

but this won't work. In fact here's what I get:

enter image description here

and so there is a login back button. Why this? Any ideas?

Silviu St
  • 1,810
  • 3
  • 33
  • 42
SagittariusA
  • 5,289
  • 15
  • 73
  • 127

1 Answers1

1

Try this one

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

It works in my sample project.

pixyzehn
  • 762
  • 6
  • 15