6

I have been adding a console window on top of the status bar:

enter image description here

This has been working great by setting its windowLevel to UIWindowLevelStatusBar + 1 up to iOS 7.x (screenshot).

On iOS 8 the same code makes the status bar disappear and offsets navigation bars up. I tried several different window levels with no luck.

I use the library on many projects and noticed that the status bar does show up when a "PopUpWindow" of level UIWindowLevelAlert is also shown. So one possible solution would be to add a mock window there but that would be plain dirty.

Rivera
  • 10,792
  • 3
  • 58
  • 102
  • If you set the level to be "StatusBar" + 1, it should cover the status bar. You are specifically setting the level to be higher than the status bar. – rmaddy Oct 02 '14 at 04:32
  • Yes. That's what I intend to do. The status bar is still there, you have an area where you can still "tap to scroll to top", and more important layout and navigation bars get correctly positioned. This however broke with iOS 8. – Rivera Oct 02 '14 at 05:33

1 Answers1

7

Try implementing the -prefersStatusBarHidden method on the root view controller of your UIWindow. Worked for me.

Ricky
  • 3,101
  • 1
  • 25
  • 33
  • Well, it worked thanks! More than unexpected as the default implementation returns `NO` already. – Rivera Nov 04 '14 at 01:44
  • Doesn't work for me on iOS9 even if both key and statusBar+1 windows have their rootViewControllers' prefersStatusBarHidden overridden to return NO – burax Jan 01 '16 at 20:54
  • Aaand I take that back. My problem was black background underneath the status bar. Adding a new window changed the status bar color to black looking as if it disappeared. Implementing `preferredStatusBarStyle` fixed that. – burax Jan 02 '16 at 11:46