Gally Gally - 5 months ago 55
iOS Question

Change foregroundcolor of statusbar

I used this code in swift 2.3 to change the foreground color of status bar:

(application.value(forKey: "statusBar") as AnyObject).setValue(, 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.


i solve my problem with this lines in the AppDelegate:

let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
statusBar.setValue(, forKey: "_foregroundColor")