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

1

7

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?
Luba answered 21/4, 2015 at 19:49 Comment(0)
P
8

Try that:

(viewControllerToBePresented).modalPresentationCapturesStatusBarAppearance = true
Potaufeu answered 11/5, 2016 at 8:33 Comment(1)
This has no effect on iOS 8.3+ but instead makes iOS 8.2- to behave in the problematic way like iOS 8.3+Luba

© 2022 - 2024 — McMap. All rights reserved.