-1

I want to hide the statusbar after I pressed a button, and after I pressed another button, I want to make the statusbar unhidden again.

So what do I have to use to hide/unhide the status bar with just a single button press?

user3578949
  • 11
  • 1
  • 3
  • 2
    http://stackoverflow.com/questions/19774968/under-ios-7-how-do-i-hide-and-show-status-bar-on-the-fly-whenever-i-want-to – Kirit Modi Aug 07 '14 at 13:42

1 Answers1

1

To do it manually, you can use this method:

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

Or you can use the View Controller based status bar appearance. You have to change your Info.plist file with the option "View controller-based status bar appearance" = YES

And you have to implement these methods in your ViewControllers

.h

@property (nonatomic) BOOL hideStatusBar;

.m

- (BOOL)prefersStatusBarHidden {
    return self.hideStatusBar;
}

- (IBAction)hideStatusBarTrigger {
    self.hideStatusBar = YES;
    [self setNeedsStatusBarAppearanceUpdate];
}

- (IBAction)showStatusBarTrigger {
    self.hideStatusBar = NO;
    [self setNeedsStatusBarAppearanceUpdate];
}
Kian
  • 122
  • 13
matt.P
  • 136
  • 3