Color text of status bar in XCode 6-b3 (Swift)

后端 未结 5 2060
闹比i
闹比i 2021-02-01 06:32

I\'ve try to modify status bar color text but no one answer from this thread doesn\'t work. Any especially for XCode 6?

I\'ve tried insert:

override func         


        
5条回答
  •  离开以前
    2021-02-01 07:24

    Swift 3.0

    Just set View controller-based status bar appearance == NO in to your *.plist and put below code in your appdelegate class in didFinishLaunchingWithOptions method before return.

    let statusBar: UIView = UIApplication.shared.value(forKey: "statusBar") as! UIView
    if statusBar.responds(to:#selector(setter: UIView.backgroundColor)) {
        statusBar.backgroundColor = UIColor.red
    }
    UIApplication.shared.statusBarStyle = .lightContent
    

    You can change backgroundColor and statusBarStyle as per your requirement.

提交回复
热议问题