After reading all the suggestions, and trying out a few things, I could get this to work for specific viewcontrollers using the following steps :

First Step:

Open your info.plist and insert a new key named “View controller-based status bar appearance” toNO

Second Step (Just an explanation, no need to implement this):

Normally we put the following code in the application(_:didFinishLaunchingWithOptions:) method of the AppDelegate,

but that affects the StatusBarStyle of all the ViewControllers.

So, how to get this working for specific ViewControllers – Final Step:

Open the viewcontroller file where you want to change the StatusBarStyle and put the following code in viewDidLoad(),

Also, implement the viewWillDisappear() method for that specific viewController and put the following lines of code,

This step will first change the statusBarStyle for the specific viewcontroller and then change it back to default when the specific viewcontroller disappears. Not implementing the viewWillDisappear() will change the StatusBarStyle permanently to the new defined value of UIStatusBarStyle.LightContent

Leave a Reply