Reputation: 73
I used this code in swift 2.3 to change the foreground color of status bar:
(application.value(forKey: "statusBar") as AnyObject).setValue(UIColor.red, forKey: "foregroundColor")
But in the update to swift 3.0 this part not work because the statusbar no have the foreground key.
Someone has been able to change the color of statusbar in swift 3.0 ?
Thank you.
Upvotes: 0
Views: 172
Reputation: 73
i solve my problem with this lines in the AppDelegate:
let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
statusBar.setValue(UIColor.red, forKey: "_foregroundColor")
Regards.
Upvotes: 1