iOS 8 - Rotation makes statusBar disappear even in portrait mode after toggling controls
Are you using UIViewController-based status bar appearance?
If you implement prefersStatusBarHidden
I assume you are.
Now,
[[UIApplication sharedApplication] setStatusBarHidden:!statusBarHidden withAnimation: UIStatusBarAnimationSlide];
is not supposed to work with UIViewController-based status bar appearance.
You need just to return different value from prefersStatusBarHidden
method and call setNeedsStatusBarAppearanceUpdate
to notify the app that returning value has changed.
So to change statusbar visibility you should just do
@property (nonatomic, assign) BOOL hideStatusBar;
- (BOOL)prefersStatusBarHidden
{
return self.hideStatusBar;
}
- (void)toggleBars:(UITapGestureRecognizer *)gesture
{
... hide navbar and tabbar ...
self.hideStatusBar = ! self.hideStatusBar;
[self setNeedsStatusBarAppearanceUpdate];
}
And that's it!
This worked for me:
- (void)viewWillLayoutSubviews {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}