为什么导航栏的色调颜色变淡了?

Why the navigation bar tint color is faded?

我目前正在 swift 开发 iOS 应用程序。这里我在屏幕顶部有 UIViewUINavigationController。我需要 topView 和 navigationBar 颜色相同。我给 topBar 背景颜色和 navigationBar 色调颜色相同。但是当屏幕加载时,navigationController 显示褪色。为什么? 我以编程方式尝试过,

self.navigationController?.navigationBar.barTintColor = UIColor.red

此外,我尝试通过情节提要,例如将导航栏的 tintColor 设置为红色。但在这两种方式中,它都不起作用。 请帮助我。

默认情况下,属性 半透明设置为是,这会降低应用到导航栏的任何颜色的饱和度。

要禁用此行为,只需 select 故事板中的导航栏并禁用属性检查器中标记为 "translucent" 的复选框。

设置navigationController?.navigationBar.isTranslucent = false为纯色导航栏。