iOS Custom Status Bar Background Color not displaying

后端 未结 9 1842
别那么骄傲
别那么骄傲 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:58

    Swift 3:

    In your AppDelegate.swift file paste the code bellow into your didFinishLaunchingWithOptions method:

    let view = UIView(frame: CGRect(x: 0.0, y: 0.0, width: UIScreen.main.bounds.size.width, height: 20.0))
    view.backgroundColor = UIColor(red: 255/255, green: 130/255, blue: 0/255, alpha: 1.0) // Organge colour in RGB
    self.window?.rootViewController?.view.addSubview(view)
    

    This works fine for me!

提交回复
热议问题