我使用下面的代码设置状态栏的背景颜色
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
{
UIView *view=[[UIView alloc] initWithFrame:CGRectMake(0, 0,320, 20)];
view.backgroundColor = [UIColor colorWithRed:(31.0/255.0) green:(109.0/255.0) blue:(128.0/255.0) alpha:1];
[self.window.rootViewController.view addSubview:view];
}
另外,我将故事板中View的背景颜色设置为完全相同的颜色(R:31,G:109,B:128)。但结果颜色并不相同。状态栏中的背景颜色比View中的背景颜色更亮。
在Info.plist中,我将Status bar style
设置为UIStatusBarStyleLightContent
,将View controller-based status bar appearance
设置为NO
。
那是因为状态栏是半透明的吗? 我怎么能改变呢? 谢谢你的任何建议。
答案 0 :(得分:0)
也许,将导航栏状态更改为不透明:
self.navigationController.navigationBar.translucent = NO;