Change the status bar background color color past iOS 7

前端 未结 8 1312
既然无缘
既然无缘 2020-12-30 04:02

I want to change background color of status bar on iOS 7, and I\'m using this code:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOp         


        
8条回答
  •  粉色の甜心
    2020-12-30 04:39

    Call this function from ViewDidLoad passing with your status bar color.

    func setStatusBarBackgroundColor(color: UIColor)  
    {
        guard  let statusBar = UIApplication.sharedApplication().valueForKey("statusBarWindow")?.valueForKey("statusBar") as? UIView 
        else 
        {
        return
        }
        statusBar.backgroundColor = color
    }
    

    Hope It'll help.

提交回复
热议问题