ChildViewControllerForStatusBarHidden to hide

I am trying to hide half of the status bar. Specifically, I am using REFrostedViewController for my sidebox, and when it exits, I would like it to go to the status, for example in this screenshot (the app is google google).

enter image description here

The current UIViewController hierarchy as such:

- REFrostedViewController
 |--MenuViewController
 |--NavigationControler
    |--ContentViewController

      

I have it UIViewControllerBasedStatusBarAppearance

set to YES

. In my drawer menu (MenuViewController) I have a method

- (BOOL)prefersStatusBarHidden
{
    return YES;
}

      

In my navigation controller, I:

- (UIViewController *)childViewControllerForStatusBarHidden {
    return self.frostedViewController.menuViewController;
}

      

This hides the status bar on all screens. When i do

- (UIViewController *)childViewControllerForStatusBarHidden {
    if (self.isDrawerOpen) 
    {
        return self.frostedViewController.menuViewController;
    } else {
        return self.frostedViewController.contentViewController;
    }
}

      

Crash. self.frostedViewController.contentViewController

contains a navigationController (which also has a method prefersStatusBarHidden

)

+3


source to share





All Articles