turbolinks / turbolinks-ios

Native iOS adapter for building hybrid apps with Turbolinks 5
MIT License
881 stars 92 forks source link

Toggling Navigation Bar's visibility #75

Closed seyfeddin closed 7 years ago

seyfeddin commented 8 years ago

Hi,

On our Turbolinks-only app, we want to show the navigation bar on pages other than the welcome page. To do that, we've set the visitableDelegate of our VisitableViewController object to itself, and toggled the navigation bar using self.navigationController.navigationBarHidden = true in delegate's visitableViewWillAppear method. However, after transitioning to another controller, second page doesn't load, and when we go back to the first page, buttons stop working.

Is this the right place and method to do this?

zachwaugh commented 7 years ago

The visitableDelegate shouldn't be changed, since it needs to talk to the Session to tell it when a view controller has appeared/disappeared. I'd recommend either subclassing VisitableViewController in this case and handling it directly in viewWillAppear, being sure to call the superclass implementation so it can perform its default handling. Or you can implement your own view controller that implements the Visitable protocol, and handle it there.