I am trying to hide half of my status bar. Specifically, I am using REFrostedViewController for my side drawer, and when it comes out, I would like it to go over the status such as in this picture (the app is Google's Inbox).
The current hierarchy of UIViewController as like so:
- REFrostedViewController
|--MenuViewController
|--NavigationControler
|--ContentViewController
I have UIViewControllerBasedStatusBarAppearance
set to YES
. In my drawer menu (MenuViewController) I have the method
- (BOOL)prefersStatusBarHidden
{
return YES;
}
In my Navigation Controller I have:
- (UIViewController *)childViewControllerForStatusBarHidden {
return self.frostedViewController.menuViewController;
}
This hides the status bar in all screens. When I do
- (UIViewController *)childViewControllerForStatusBarHidden {
if (self.isDrawerOpen)
{
return self.frostedViewController.menuViewController;
} else {
return self.frostedViewController.contentViewController;
}
}
It crashes. self.frostedViewController.contentViewController
holds a navigationController (which also has the prefersStatusBarHidden
method implemented)