简体   繁体   English

iOS 9中的黑色状态栏

[英]Black status bar in iOS 9

I'm trying to get the status bar to be black for my app since it would look a lot better with my content. 我正在尝试使状态栏对于我的应用程序为黑色,因为它的内容看起来要好得多。

Everything I've been reading is I would need: 我一直在阅读的所有内容都需要:

UIView* loadingView;
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNeedsStatusBarAppearanceUpdate];
}

and

-(UIStatusBarStyle) preferredStatusBarStyle
{

    return UIStatusBarStyleBlackOpaque;
}

But this results in an entirely white status bar with no text or battery indicator. 但这会导致状态栏变成全白,没有文本或电池指示。 Possibly because its depreciated? 可能是因为它贬值了吗? How do I achieve this in iOS 9+? 如何在iOS 9+中实现此目标?

The status bar is transparent in iOS 9. 状态栏在iOS 9中是透明的。

But this results in an entirely white status bar with no text or battery indicator 但这会导致状态栏变成全白,没有文字或电池指示

No it doesn't. 不,不是。 It results in a transparent status bar containing white text and battery indicator — and you can't see that, because (as I just said) the status bar is transparent, and what's behind the status bar is also white. 这样会导致透明的状态栏包含白色文本和电池指示器-您看不到,因为(正如我刚才说的)状态栏是透明的,而状态栏后面的也是白色。

I'm trying to get the status bar to be black for my app 我正在尝试使状态栏对于我的应用程序为黑色

You can't. 你不能 The status bar is transparent (as I believe I've mentioned). 状态栏是透明的(我相信我已经提到过)。 If you want it to seem black, put a black view behind it. 如果您希望它看起来是黑色的,请后面放置黑色视图。

In other words, the black region behind the status bar, which you think will look good with your content, will need to be part of your content. 换句话说,状态栏后面的黑色区域(您认为会与内容看起来很好)将成为您内容的一部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM