有没有办法改变状态栏的背景颜色现在它显示白色和黑色电池图标我想要黑色这是我在 viewDidLoad 中使用的代码
if ([self respondsToSelector:@selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
在 iOS 7 中,状态栏是透明的。如果您正在设置,请确保背景视图为深色UIStatusBarStyleLightContent
有关更多信息,您可以查看Apple UITransition 指南
Set UIViewControllerBasedStatusBarAppearance
to NO. Call
[[UIApplication sharedApplication]
setStatusBarStyle:UIStatusBarStyleLightContent];
For more details...check this link
EDIT: try adding this
self.extendedLayoutIncludesOpaqueBars = YES;
1)在plist中设置UIViewControllerBasedStatusBarAppearance
为YES
2)在viewDidLoad
做一个[self setNeedsStatusBarAppearanceUpdate]
;
3)添加以下方法:
-(UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}