Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sendoa/19c4453ee76c37527771 to your computer and use it in GitHub Desktop.
Save sendoa/19c4453ee76c37527771 to your computer and use it in GitHub Desktop.
Hide status bar & navigation bar together
- (IBAction)handleTap:(id)sender
{
BOOL isHiding = !_statusBarHidden;
_statusBarHidden = isHiding;
[UIView animateWithDuration:UINavigationControllerHideShowBarDuration delay:0 options:0
animations:^{
[self setNeedsStatusBarAppearanceUpdate];
}
completion:NULL];
if (!isHiding)
{
NSLog(@"Hidden");
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
else
{
NSLog(@"not hidden");
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
}
#pragma mark - Bar Appearance
- (BOOL)prefersStatusBarHidden {
return _statusBarHidden;
}
- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation
{
return UIStatusBarAnimationSlide;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment