There are many way to do, I show a trick, don’t follow me :D
extension UIApplication {
class func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else { return }
statusBar.backgroundColor = color
}
}
Do and see the change:
UIApplication.setStatusBarBackgroundColor(.grayColor())