I know there are many questions related to this but I have tried almost everything. I am using SSASidemenu and preferredStatusBarStyle()
is calling every time while moving from one ViewController to another and I am able to set the color only once. But I need to show both light and dark status bar in different viewControllers. I have created a custom viewController class in which I need to show dark status bar and .light for others.
Can anyone tell me the solutions
If you need to set the status bar anytime one of your subclasses of ViewController
appears, you can do so in the viewDidAppear
method:
func viewDidAppear(_ animated: Bool)
NOTE: You could also probably set it in func viewDidLayoutSubviews()
- that fires anytime the subviews need to be laid out, I'm just not sure if the status bar is technically a subview, you could test it out - viewDidAppear
is most likely an acceptable choice.