Skip to main content

iOS app: statusbar color

Go to ViewController.swift.
Between "Import …" and "class …" add:

// Diese Extension ist für den gefärbten Statusbar nötig
extension UIApplication {
    var statusBarView: UIView? {
        if responds(to: Selector(("statusBar"))) {
            return value(forKey: "statusBar") as? UIView
        }
        return nil
    }
}

In function "override func viewDidLoad() {" add color:

// Farbe des Statusbar
        UIApplication.shared.statusBarView?.backgroundColor = UIColor(red:0.15, green:0.41, blue:0.71, alpha:1.0)

UIColor had to be converted from hex or rgb before: uicolor.xyz