LoginSignup
12
10

More than 5 years have passed since last update.

iOS7でステータスバーが消えない時

Posted at

今更感がありますが、iOS7からはステータスバーの消し方が変わりました。

- (BOOL)prefersStatusBarHidden {
    return true;
}

を実装し、

setNeedsStatusBarAppearanceUpdate

を呼ぶ必要があります。
…が、これで消えないことがあります。

Info.plist内の
View controller-based status bar appearance
がNOになっている場合。
この場合はiOS6同様

[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];

を呼んで消す必要があります。
iOS7からステータスバーの制御がViewController単位での管理に変わり、setStatusBarHidden:withAnimation:がdeprecatedになったと思い込みがちですが、あくまでiOS7からステータスバーの制御がViewController単位での管理が”出来るようになった”だけなので、ご注意を

12
10
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
12
10