title: childViewControllerForStatusBarHidden For Hiding
body: <p>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).</p>
  
  <p><img src="https://i.stack.imgur.com/usMYH.jpg" alt="enter image description here"></p>
  
  <p>The current hierarchy of UIViewController as like so:</p>
  
  <pre><code>- REFrostedViewController
   |--MenuViewController
   |--NavigationControler
      |--ContentViewController
  </code></pre>
  
  <p>I have <code>UIViewControllerBasedStatusBarAppearance</code> set to <code>YES</code>. In my drawer menu (MenuViewController) I have the method</p>
  
  <pre><code>- (BOOL)prefersStatusBarHidden
  {
      return YES;
  }
  </code></pre>
  
  <p>In my Navigation Controller I have:</p>
  
  <pre><code>- (UIViewController *)childViewControllerForStatusBarHidden {
      return self.frostedViewController.menuViewController;
  }
  </code></pre>
  
  <p>This hides the status bar in all screens. When I do </p>
  
  <pre><code>- (UIViewController *)childViewControllerForStatusBarHidden {
      if (self.isDrawerOpen) 
      {
          return self.frostedViewController.menuViewController;
      } else {
          return self.frostedViewController.contentViewController;
      }
  }
  </code></pre>
  
  <p>It crashes. <code>self.frostedViewController.contentViewController</code> holds a navigationController (which also has the <code>prefersStatusBarHidden</code> method implemented)</p>