-1

So I have the subview (side menu) pulled out on top of the main view inside of a Navigation Controller. Is it possible to hide the status bar on the slide out menu but continue to show it on the main view?

Note: one view is currently on top of the other

So I have the subview (side menu) pulled out on top of the main view inside of a Navigation Controller. Is it possible to hide the status bar on the slide out menu but continue to show it on the main view?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Rich
  • 1
  • 1
  • 1
    It's not possible to hide only half of the status bar, I would recommend either starting the menu below the status bar or hiding the status bar, but the first is better in my opinion – Zach Fuller May 19 '17 at 20:55
  • Ok. Then how is this done? http://imgur.com/a/aXrRu @ZachFuller – Rich May 19 '17 at 21:19
  • I personally find that screenshot poor UI, but it's likely a combination of (1) container views with (2) an override on `prefersStatusBarHidden` for each view, along with possibly (3) view hierarchy or even (4) a presentation view controller. Again, why put a combination - like that screenshot - where *half* of the time is blocked? I gave @ZachFuller the "useful" tick on his comment because he had the right idea. Keep it simple - for both future developers and the users - by simply putting the menu below the status bar. Virtually every iOS user expects it. –  May 20 '17 at 01:18

2 Answers2

0
override var prefersStatusBarHidden: Bool {  
return true  

}

try this ... Can't Hide Status Bar—Swift 3,

Community
  • 1
  • 1
Hobbit
  • 601
  • 1
  • 9
  • 22
0

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
    stautsBarWindow.rootViewController = yourSideMenuViewController
    stautsBarWindow.windowLevel = UIWindowLevelStatusBar
    stautsBarWindow.isHidden = false

This will create another window object at the top of your status bar. So just slide it pretty left side so that you can see only half of it/ reduce its width to half of the screen so that you can only see half visible area and show full viewController inside this area. Which ever logic you think is right just use that.

Syed Qamar Abbas
  • 3,637
  • 1
  • 28
  • 52