0

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

iOS Developer
  • 464
  • 6
  • 24
  • i think you are almost there, when each controller appears you can set the status bar how you want for that controller, you can do it in `func viewDidAppear` - if you have to set it everytime it appears, that isn't a big deal, just part of the functionality. – ewizard May 03 '20 at 06:53

1 Answers1

0

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)

viewDidAppear

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.

ewizard
  • 2,801
  • 4
  • 52
  • 110