Last active
August 29, 2015 14:15
-
-
Save HituziANDO/b3171a97d1440196172d to your computer and use it in GitHub Desktop.
iOSのステータスバースタイル変更
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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