What is the default background color of the navigation bar in iOS 7?

后端 未结 8 1460
星月不相逢
星月不相逢 2020-12-31 00:45

I would like to set the background color of a menu to that of the navigation bar. What is the best way to do this?

相关标签:
8条回答
  • 2020-12-31 00:47

    Swift 4

    I am not sure the color does not change from version to version. In my app I use this:

    var navBarDefaultColor: UIColor?
    
    // save:
    navBarDefaultColor = self.navigationController?.navigationBar.tintColor
    
    //restore:
    self.navigationController?.navigationBar.tintColor = navBarDefaultColor!
    
    0 讨论(0)
  • 2020-12-31 00:49

    The default navbar color in iOS 7 is [UIColor colorWithRed:(247.0f/255.0f) green:(247.0f/255.0f) blue:(247.0f/255.0f) alpha:1];

    0 讨论(0)
  • 2020-12-31 00:50

    Swift 5: UINavigationBar Default barTintColor for Light Mode.

    #colorLiteral(red: 0.9763854146, green: 0.9765252471, blue: 0.9763546586, alpha: 1)
    
    0 讨论(0)
  • 2020-12-31 00:56

    In Swift, it is:

    UIColor(colorLiteralRed: (247/255), green: (247/255), blue: (247/255), alpha: 1)
    
    0 讨论(0)
  • 2020-12-31 01:01

    Swift 5

    Nav bar color in light appearance:

    UIColor(red: 0.969, green: 0.969, blue: 0.969, alpha: 1.0)
    
    0 讨论(0)
  • 2020-12-31 01:03

    To get the tint color of a navigation bar, do this:

    [aNavbar barTintColor]
    

    By using this when you set the background color of your menu, you will not have to change it in case you change your navigation bar tint.

    0 讨论(0)
提交回复
热议问题