status bar 색상 변경

2016. 9. 5. 10:54Programming/Swift

반응형

* AppDelegate

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        // Override point for customization after application launch.

        UIApplication.sharedApplication().valueForKey("statusBar")?.setValue(UIColor.redColor(), forKey: "foregroundColor")

        return true

    } 



- swift 3.0

//        let statWindow = UIApplication.shared.value(forKey:"statusBar") as? UIView

        

//        if let sub = statWindow?.subviews[0] {

//            let statusBar = sub as UIView

//            statusBar.backgroundColor = UIColor(red: 206/255.0, green: 206/255.0, blue: 210/255.0, alpha: 1.0)

//        }

//        

반응형