53

アプリを起動すると、起動イメージと黒いステータス バーが表示されます。起動時にステータスバーが明るくなるように変更するにはどうすればよいですか? AppDelegate didFinishLoading メソッドでステータス バーの外観を点灯するように設定しました。これはアプリの残りの部分で機能します。

4

6 に答える 6

109

Info.plistファイルに、次のキーと値のペアを追加します

UIStatusBarStyle: UIStatusBarStyleLightContent

デフォルト (黒) の値はUIStatusBarStyleDefaultです。

~iphoneキーにorを追加することもでき~ipadます。

于 2013-09-20T19:28:44.857 に答える
3

私の場合、UIStatusBarStyleLightContent可能なオプションではありませんでした。Transparent black style (alpha of 0.5).plistのキーの値として設定するStatus bar styleと、結果は白いステータス バーになりました。

于 2014-03-08T12:20:38.060 に答える
0
**

 - You must take care of these three things:

**

**- In info.plist file**
Set UIViewControllerBasedStatusBarAppearance to YES

**- In your view controller** in which you want change color of status bar
add this [self setNeedsStatusBarAppearanceUpdate] in viewDidLoad

**- Lastly, add this method**
- (UIStatusBarStyle)preferredStatusBarStyle
{
      return UIStatusBarStyleLightContent;
}

Note: If you want to set color of statusBar for all the View Controllers then steps are
**- In info.plist file**
Set UIViewControllerBasedStatusBarAppearance to YES

**- Then add this in appDelegate**
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent; // **It is deprecated in iOS 9**
于 2015-10-03T12:31:49.220 に答える