LoginSignup
5
5

More than 5 years have passed since last update.

iOS 7 でステータスバーのスタイルを設定する方法

Last updated at Posted at 2013-09-24

UIViewControllerで以下のメソッドを定義
※ これは定義してもiOS6以下に影響なし

- (UIStatusBarStyle)preferredStatusBarStyle
{
    return UIStatusBarStyleBlackOpaque;
}

viewDidLoadあたりで以下を呼び出し
※ これは呼び出すとiOS 6以下でクラッシュ

[self setNeedsStatusBarAppearanceUpdate];

実際は以下のようにiOS7かどうか判定する

if ([Util isIOS7])
{
    [self setNeedsStatusBarAppearanceUpdate];
}

※ isIOS7メソッドについては以下
http://qiita.com/jazzsasori/items/f243dd7c47151be02384

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5