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?
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?
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];
}