【发布时间】:2014-08-14 14:54:06
【问题描述】:
我想更改状态栏的背景颜色,并且该背景颜色应与导航栏背景颜色相同,即深灰色。我的问题是使用下面的代码为状态栏和导航栏提供相同的颜色后,我得到了不同的颜色。我已经将 UIViewControllerBasedStatusBarAppearance 设置为 NO。请建议我在哪里做错了,我附上了下面的图片供您参考。
这是我的 App 委托代码 - didFinishLaunchingWithOptions:
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
//For changing status bar background color
self.window.backgroundColor = [UIColor darkGrayColor];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];
//For changing navigation bar background color
[[UINavigationBar appearance] setBackgroundColor:[UIColor darkGrayColor]];
[[UINavigationBar appearance] setTintColor:[UIColor darkGrayColor]];
【问题讨论】:
-
UIStatusBarStyleLightContent和[UIColor darkGrayColor]一样吗? -
sry.. 我附上截图供您参考。
标签: ios ios7 uinavigationbar statusbar