我想开发UINavigationBar并设置背景颜色.我创建了UINavigationBar但是我有设置backgroundcolor的问题.有人请帮助我.谢谢.
Pra*_*d G 14
[self.navigationController.navigationBar setBackgroundColor:[UIColor redColor]];
Run Code Online (Sandbox Code Playgroud)
试试这样吧.我认为这对你有所帮助.
编辑:更新代码以实际编译.
Eru*_*o87 13
在新的iOs中,它是如何工作的:
self.navigationController.navigationBar.barStyle = UIBarStyleBlackOpaque;
self.navigationController.navigationBar.barTintColor =[UIColor colorAzulNavegacion];
Run Code Online (Sandbox Code Playgroud)
n13*_*n13 10
我每次都要看这个,所以在这里添加我的答案(斯威夫特).下面的代码是为应用程序中的所有导航栏设置此代码.如果您愿意,也可以在各个导航栏上设置其中的每一个.
您可以设置半透明度,标题文本颜色,背景颜色(这称为barTintColor,谢谢,Apple!)和条形按钮项目前景色,如下所示:
// Title text color Black => Text appears in white
UINavigationBar.appearance().barStyle = UIBarStyle.Black
// Translucency; false == opaque
UINavigationBar.appearance().translucent = false
// BACKGROUND color of nav bar
UINavigationBar.appearance().barTintColor = UIColor.redColor()
// Foreground color of bar button item text, e.g. "< Back", "Done", and so on.
UINavigationBar.appearance().tintColor = UIColor.whiteColor()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17247 次 |
| 最近记录: |