1

I have implemented a interactive dismissal animation for a controller that is being presented full screen.

The issue is that whenever I try to dismiss it status bar appearsimage

The full screen controller has its - (BOOL)prefersStatusBarHidden returning true so the bar isn't visible when presented.

The presenting view controller is embedded in a navigation controller.

Thing's I've tried:

  • setting - (BOOL)prefersStatusBarHidden to true and calling setNeedsStatusBarAppearanceUpdate in viewWillAppear in the presenter

  • changing the presenters navigationController.navigationBar.barStyle properties

Twitter app has the bar hidden when dismissing, so I guess this must be possible

twitter

saurabh
  • 6,687
  • 7
  • 42
  • 63
Mindaugas
  • 69
  • 1
  • 6

2 Answers2

4

I have achieved the same status bar behavior as in the Twitter app.

The secret is to change the [[UIApplication sharedApplication] keyWindow]'s UIWindowLevel to UIWindowLevelStatusBar before the presentation animation and change it back to UIWindowLevelNormal (or whatever your window's level was) after the dismissal.

Mindaugas
  • 69
  • 1
  • 6
0

Try this inside viewWillAppear()

UIApplication.sharedApplication().statusBarHidden = true

saurabh
  • 6,687
  • 7
  • 42
  • 63
ranjit.x.singh
  • 307
  • 4
  • 9
  • This works if I set `View controller-based status bar appearance` to `NO` in `.plist`, but isn't this method deprecated since iOS9? – Mindaugas Jun 04 '16 at 18:42
  • And `UIApplication.sharedApplication().statusBarHidden = true` does nothing afterwards :( – Mindaugas Jun 04 '16 at 18:51