In XCode 7.3.x ill changed the background Color for my StatusBar with:
func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView else {
return
}
statusBar.backgroundColor = color
}
But it seems that this is not working anymore with Swift 3.0.
Ill tried with:
func setStatusBarBackgroundColor(color: UIColor) {
guard let statusBar = (UIApplication.shared.value(forKey: "statusBarWindow") as AnyObject).value(forKey: "statusBar") as? UIView else {
return
}
statusBar.backgroundColor = color
}
But it gives me:
this class is not key value coding-compliant for the key statusBar.
Any Ideas how to change it with XCode8/Swift 3.0?
You can set background color for status bar during application launch or during viewDidLoad of your view controller.
Here is result:
Try this
Goto your app info.plist
Then Goto your app delegate and paste the following code where you set your Windows's RootViewController.