- (void)loadView
{
[super loadView];
// loadViewで設定しないとviewDidLoadでサイズが全画面仕様にならない
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
self.navigationController.navigationBar.translucent = YES;
self.wantsFullScreenLayout = YES;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// navigationがpopされて戻ってきた時用
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleBlackTranslucent;
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
self.navigationController.navigationBar.translucent = YES;
self.wantsFullScreenLayout = YES;
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
// 全画面表示を戻す
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
self.navigationController.navigationBar.translucent = NO;
self.wantsFullScreenLayout = NO;
}
More than 5 years have passed since last update.
NavigationBarとStatusBarを半透明にして全画面表示にする
Last updated at Posted at 2012-09-07
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme