ios - RGB 颜色,颜色错误

标签 ios swift uicolor

我目前正在使用 Swift 3 开发一个 iOS 应用程序,想更改我的 NavigationBar 的颜色 使用以下代码:

self.navigationController?.navigationBar.barTintColor = UIColor.init(red: 53.0/255.0, green: 70.0/255.0, blue: 90.0/255.0, alpha: 1.0)

这段代码工作得很好,但有一个问题。我输入的 RGB 格式的颜色显示错误。

应该是这样的颜色:enter image description here

但是看起来像这样(左:是current Color() 右:已经说过应该是这样的):

enter image description here

最佳答案

设置navigationController?.navigationBar.isTranslucent = false。

您也可以通过取消选中 Storyboard 中的半透明来实现此目的。

enter image description here

关于ios - RGB 颜色,颜色错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45817455/

相关文章:

ios - 启动远程程序时出错 : launch or suspend in progress

iphone - 核心数据插入错误

swift - 连字 SwiftUI 文本

ios - 在滑动手势、iOS、Swift 上将 View 更改为圆圈

iOS:有没有办法改变屏幕上每个像素的颜色?

iphone - 字体颜色疑惑

ios - 图案图像如何实现视差效果?

iphone - 临时 OTA 分发安装错误

ios - 容器 View 和容器 View Controller 有什么区别?

ios - UINavigationController 向下滑动手势检测