Valid for updating the FullScreen status FullScreen automatically, but not for OverFullScreen .
Also, in my case, I needed to deal with the navigation controller on the stack in order to pass the ModalViewController as a child:
extension UINavigationController { public override func childViewControllerForStatusBarHidden() -> UIViewController? { return self.visibleViewController } public override func childViewControllerForStatusBarStyle() -> UIViewController? { return self.visibleViewController } }
Inside ModalViewController we manually update the status bar to make it smooth, we have to do it in viewWillDisappear , but at this point visibleViewController still ModalViewController >, there is nothing left to use the internal status of boolBarHidden and update it accordingly.
override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) self.statusBarHidden = true self.setNeedsStatusBarAppearanceUpdate() } override func viewWillDisappear(animated: Bool) { super.viewWillDisappear(animated) self.statusBarHidden = false self.setNeedsStatusBarAppearanceUpdate() } override func prefersStatusBarHidden() -> Bool { return self.statusBarHidden }
source share