Search code examples
iosobjective-cswiftstatusbaruistatusbar

Change status bar style with animation


Since UIApplication.shared.setStatusBarStyle(.default, animated: true) is deprecated from IOS9 is it possible to change status bar style with animation on push? I cannot find any description in docs.


Solution

  • It's now a variable you have to override:

    override var preferredStatusBarStyle: UIStatusBarStyle
    override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation
    

    Depending on when you update the status bar, you might also have to call setNeedsStatusBarAppearanceUpdate()