Member-only story

preferredStatusBarStyle not called in swift ?

The Blue Prototype
3 min readJul 12, 2020

--

As per the Apple doc, UIStatusBarStyle is the style of the device’s status bar. It is a enum type.

Get Started

Now, we can have two types of requirements to set the UIStatusBar style in swift projects.

Use the single type of UIStatusBarStyle for entire project:

There are two steps to set the one common style in an entire project.

  1. Add ‘View controller-based status bar appearance’ to ‘NO’ in project info.plist
  2. Select UIStatusBarStyle in Deployment Info of project target.
Deployment Info

Use the ViewControllers based UIStatusBarStyle for entire project:

There are two steps to set the ViewControllers based status bar in a project.

  1. Remove ‘View controller-based status bar appearance’ the key from info.plist because by default it is true or you can add the ‘View controller-based status bar appearance’ to ‘YES’ in info.plist
  2. Override the statusBarStyle properties in viewControllers.

--

--

Responses (4)