HidingNavigationBar
HidingNavigationBar copied to clipboard
nav bar shows when app goes back to foreground
- scroll up hide nav bar
- press home button let app into background
- and then press again
oh, the nav bar appears, this is what i dont expected
To fix this issue I added some logic to the default case for applicationWillEnterForeground
. It expands or contracts the views based on the currentState
.
func applicationWillEnterForeground() {
switch onForegroundAction {
case .show:
_ = navBarController.expand()
_ = tabBarController?.expand()
case .hide:
_ = navBarController.contract()
_ = tabBarController?.contract()
default:
switch currentState {
case .Open, .Expanding:
_ = navBarController.expand()
_ = tabBarController?.expand()
case .Closed, .Contracting:
_ = navBarController.contract()
_ = tabBarController?.contract()
}
}
}