Marcel Zanoni Marcel Zanoni - 2 months ago 13
iOS Question

Changing the default UIStatusBarStyle when using UIViewControllerBasedStatusBarAppearance

I'm developing an application containing several view controllers.
A few of those view controllers should use the

style, the rest should default to the

I want to use
View controller-based status bar appearance
set to YES in my Info.plist. It would be nice if I don't need to implement
in every single ViewController (there are a lot), but only in the ones using the default style. So I'm looking for the least possible code change in all of the VCs.

I've tried setting the "general" UIStatusBarStyle in the Target settings, but this doesn't change anything when View controller-based status bar appearance is set to YES.

Please don't provide answers using
or the
property as these are deprecated and the reason why I'm asking this question.


The Default style is the default! So you do indeed add code only where you want the Light style.

Here's the thing to keep in mind. The API is that every top-level view controller dictates how it wants the status bar to appear. You probably don't have many of those. So not much code will be needed at all.