简体   繁体   English

在Swift中更改导航栏颜色

[英]Changing the navigation Bar color in Swift

I am attempting to change the color of my Navigation bar. 我正在尝试更改导航栏的颜色。 Attached below are images of my navigation bar at runtime, the storyboard of my app, and lastly the attribute inspector. 以下是运行时导航栏的图像,应用程序的情节提要,最后是属性检查器。

导航栏

在此处输入图片说明

属性检查器

文件大纲

I have been through several StackOverflow pages and still can not find a successful way to change the color of my navigation bar. 我已经浏览过多个StackOverflow页面,但仍然找不到改变导航栏颜色的成功方法。 Any changes I make in the attribute inspector are not shown at runtime. 我在属性检查器中所做的任何更改都不会在运行时显示。

Try 尝试

navigationController!.navigationBar.barTintColor = UIColor(red: 37/255, green: 116/255, blue: 169/255, alpha: 1)

Where can I contact this code? 我在哪里可以联系该代码?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM