How to get a black status bar on an iPhone app?

徘徊边缘 提交于 2020-01-01 01:16:11

问题


I want to use a black status bar for my iPhone app. I have selected black status bar on all of my .xibs but I still can't get it to be black. Is this an issue that anyone else has seen or knows how to remedy?


回答1:


  1. Open the "info.plist" file .
  2. Add a new row.
  3. Select "Status bar style" as the key.
  4. Select "Opaque black style" as the value.

EDIT: The comment by @codrut below to choose the value:
If you go far to the right, there's a button that brings you a drop down with the possible options.




回答2:


The status bar in the nib files is there as an indication, just to simulate the real interface. What you need to do is:

 [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];

and in the plist change the Status Bar Style (UIStatusBarStyle) to Black opaque (UIStatusBarStyleBlackOpaque) (or whatever you want).




回答3:


Add the following in the info.plist file

<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleBlackOpaque</string>



回答4:


Not sure if this will help anyone else, but in our app we ran into an issue where the only way we could get it to use the black style was if we set it to the default style:

[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault];

Might be worth giving that a try if BlackOpaque isn't working for you.




回答5:


Try this simple method....

1.For single viewController

[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackOpaque];

2.For whole application

info.plist
      ----> Status Bar Style
                  --->UIStatusBarStyle to UIStatusBarStyleBlackOpaque


来源:https://stackoverflow.com/questions/6792376/how-to-get-a-black-status-bar-on-an-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!