Skip to content

Instantly share code, notes, and snippets.

@Tinyik
Created December 20, 2017 06:03
Show Gist options
  • Select an option

  • Save Tinyik/3509f61f3ca2dabd57b5e2c29cc98149 to your computer and use it in GitHub Desktop.

Select an option

Save Tinyik/3509f61f3ca2dabd57b5e2c29cc98149 to your computer and use it in GitHub Desktop.
Hide/Show UINavigationBar on push/pop, without invalidating swipe back gesture
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.navigationController?.setNavigationBarHidden(true, animated: true)
self.navigationController?.interactivePopGestureRecognizer?.delegate = nil
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
if self.isMovingFromParentViewController {
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment