1
votes

I have multiple storyboards in my project. I have a home page view controller in one storyboard, and I have a Setup view controller embedded in a navigation controller in a separate storyboard. Now when I Present the setup view controller navigation controller from the homepage view controller, the status bar won't hide. But when I set the setup view controllers storyboard as the main storyboard file base in the info.plist and the setup view controller navigation controller is the first view presented then the status bar will hide. I'm using the code below to hide the status bar. Can someone show me how to hide the status bar when the status view controller is presented by another storyboard view controller instead of being set as the first view controller. Here is the code I'm using to hide the status bar,

override var prefersStatusBarHidden: Bool {  
      return true  
} 
1
Have you got UIViewControllerBasedStatusBarAppearance set to true in your info.plistadamfowlerphoto
I did and it didn't workjohn
i added this vc.modalPresentationCapturesStatusBarAppearance = true and it didn't work eitherjohn
the status bar is still showingjohn

1 Answers

0
votes

You can hide status bar in a condition.. You need to add another Window Object over the status bar.

let stautsBarWindow = UIWindow(frame: UIScreen.main.bounds)
stautsBarWindow.backgroundColor = UIColor.clear
//Instead of Presenting just assign your viewController in below line it will hide your statusBar as well.
stautsBarWindow.rootViewController = yourSideMenuViewController
stautsBarWindow.windowLevel = UIWindowLevelStatusBar
stautsBarWindow.isHidden = false