I have three view controllers: A login view, a home tableview screen, and a detail tableview screen. These are all part of the same UINavigationController. On the home screen, I want to disable the back button, preventing a user from backing into the login screen. So in the viewDidLoad()
function I have
// Home View
override func viewDidLoad() {
super.viewDidLoad()
self.navigationItem.hidesBackButton = true
...
}
When this view shows up, there is no back arrow but there is the word "Back." This button does nothing, it seems disabled. When I go to the next view (the detail view), the back button is hidden. Even if I add a hidesBackButton = false
to the viewDidLoad
of this view, still nothing. However, the swipe to the right on the navigation bar allows going back.
Now that I am back on the home screen, the back button is completely hidden. If I were to then proceed forward again to the detail view, the back button appears as desired.
Here's the Sequence of Events:
- Login Screen. After you log in the home screen is popped on.
- The Home Screen. The back button is there, where it shouldn't.
- The detail view. This view should have a back button to go back to the home screen. The swipe functionality still works, so you can go back to the home screen by swiping the navigation bar.
- When you've gone back, the back button is gone! Like it should be.
- Finally, going back (forward) to the detail view, the back button is there as it should be.
Aucun commentaire:
Enregistrer un commentaire