samedi 28 février 2015

UINavigationController hides back button only on second appearance of view

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:



  1. Login Screen. After you log in the home screen is popped on.


First Login Screen



  1. The Home Screen. The back button is there, where it shouldn't.


Back Button appears without arrow



  1. 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.


Detail Test View. Should have Back button



  1. When you've gone back, the back button is gone! Like it should be.


Back To Home.



  1. Finally, going back (forward) to the detail view, the back button is there as it should be.


Back to Detail




Aucun commentaire:

Enregistrer un commentaire