What is the default background color of the naviga

2019-02-05 19:42发布

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?

7条回答
Deceive 欺骗
2楼-- · 2019-02-05 19:56

In Swift, it is:

UIColor(colorLiteralRed: (247/255), green: (247/255), blue: (247/255), alpha: 1)
查看更多
\"骚年 ilove
3楼-- · 2019-02-05 20:03

Swift 4

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

var navBarDefalutColor: UIColor?

// save:
navBarDefalutColor = self.navigationController?.navigationBar.tintColor

//restore:
self.navigationController?.navigationBar.tintColor = navBarDefalutColor!
查看更多
孤傲高冷的网名
4楼-- · 2019-02-05 20:11

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.

查看更多
beautiful°
5楼-- · 2019-02-05 20:14

Swift 3.0 +

UIColor(red: (247/255), green: (247/255), blue: (247/255), alpha: 1)

查看更多
叼着烟拽天下
6楼-- · 2019-02-05 20:19

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];

查看更多
时光不老,我们不散
7楼-- · 2019-02-05 20:22

Swift 4

UIColor(red: 0.969, green: 0.969, blue: 0.969, alpha: 1.0)
查看更多
登录 后发表回答