Here's a fragment of my Storyboard
:
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:
and so there is a login back button. Why this? Any ideas?
Try this one
self.tabBarController?.navigationItem.setHidesBackButton(true, animated: true)
It works in my sample project.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.