Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 8.3 modalPresentationStyle OverCurrentContext does not inherit status bar appearance and visibility

Consider the following setup:

  • You have a simple application with a single UINavigationController subclass and a single UIViewController subclass in it.
  • The UINavigationController overrides preferredStatusBarStyle() method and returns UIStatusBarStyle.LightContent
  • The UIViewController overrides prefersStatusBarHidden() method and returns true

In iOS 8.0 - 8.2 when another UINavigationController (with another UIViewController that does not override anything) is presented with the modalPresentationStyle set to UIModalPresentationStyle.OverCurrentContext, the newly presented controller inherits the status bar appearance and visibility.

But in iOS 8.3 in the exact same situation - the newly presented controller does not inherits the status bar appearance and visibility

Another example would be to present an instance of UIImagePickerController - the exact same thing happens regarding the status bar appearance.

The questions are:

  • Why in iOS 8.3 the newly presented controller does not inherit the status bar appearance?
  • What has been changed (I was unable to find any meaningful reference in the iOS 8.2 to 8.3 API diff regarding this)?
  • Is there any elegant solution to this, instead of overriding everywhere the appearance and visibility methods?
like image 577
KoCMoHaBTa Avatar asked Apr 21 '15 19:04

KoCMoHaBTa


1 Answers

Try that:

(viewControllerToBePresented).modalPresentationCapturesStatusBarAppearance = true
like image 101
Fabio Avatar answered Oct 13 '22 01:10

Fabio