问题描述
我希望我的应用程序的状态栏与我的导航栏具有完全相同的颜色.我发现改变状态栏颜色的方法只是创建一个状态栏大小的视图并更改背景颜色.
I want the Status Bar of my app to have the exact same color as my Navigation Bar. The way I found to change the color of the Status Bar was just by creating a view in the size of the Status Bar and change the background color.
然而,即使我使用导航栏中的颜色选择器来设置视图的颜色,我也会得到 2 种完全不同的颜色,如下图所示.
However even though I use the color picker from the Nav bar to set the color of the view I get 2 totally different colors as seen in the picture below.
我尝试使用颜色选择器进行混合、更改不透明度等,但是我永远无法找到正确的颜色.关于如何为状态栏获得完全相同的颜色的任何想法?
I've tried mixing with the color picker, changing opacity etc, however I'm never able to hit the correct color. Any ideas on how I can get the exact same color for the status bar?
推荐答案
UIStatusBar
的颜色会自动设置为与 UINavigationBar
的颜色匹配self.navigationController.navigationBar.barTintColor
的值.是否有理由需要单独设置它们?
The color of the UIStatusBar
is automatically set to match the color of the UINavigationBar
when you set the value of self.navigationController.navigationBar.barTintColor
. Is there a reason you need to set them separately?
这篇关于将状态栏颜色设置为与导航栏相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!