iOS Custom Status Bar Background Color not displaying

后端 未结 9 1838
别那么骄傲
别那么骄傲 2020-12-16 13:30

I am trying to fill the status bar background color to orange using the following

UINavigationBar.appearance().tintColor = UIColor.orangeColor()
UINavigation         


        
9条回答
  •  离开以前
    2020-12-16 13:53

    I think your last line is reverting your changes, try this:

    override func viewWillAppear(animated: Bool) {
    UIApplication.sharedApplication().setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true)
            super.viewWillAppear(animated)
            var nav = self.navigationController?.navigationBar
            nav?.barStyle = UIBarStyle.Black
            nav?.tintColor = UIColor.orangeColor()
            nav?.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.whiteColor()]
        }
    

提交回复
热议问题