Skip to content

Instantly share code, notes, and snippets.

@HituziANDO
Last active August 29, 2015 14:15
Show Gist options
  • Save HituziANDO/b3171a97d1440196172d to your computer and use it in GitHub Desktop.
Save HituziANDO/b3171a97d1440196172d to your computer and use it in GitHub Desktop.
iOSのステータスバースタイル変更
// info.plistの"View controller-based status bar appearance"をYESにする
// 各ViewControllerで下記のように実装する
// "View controller-based status bar appearance"をNOにした場合はinfo.plistの"Status bar style"が全ViewControllerに適用される
// "View controller-based status bar appearance"をinfo.plistに追加していない場合は変更は適用されない
- (void) viewDidLoad {
[super viewDidLoad];
// 変更を通知
if ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {
[self setNeedsStatusBarAppearanceUpdate];
}
}
// YESを返すと非表示
- (BOOL) prefersStatusBarHidden {
return YES;
}
// LightContentで白文字, Defaultで黒文字に
- (UIStatusBarStyle) preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment