title: UIViewController Present
body: <p>I am trying to present a <code>UIViewController</code> with a <code>UIView</code> on it.</p>
  
  <p>The following is the code I am trying in my <code>viewDidLoad</code> method.</p>
  
  <pre><code>//create the view controller
  UIViewController *controller = [[UIViewController alloc] init];
  UIView *view = [[UIView alloc] init];
  view.backgroundColor = [UIColor whiteColor];
  
  controller.view = view;
  
  //show the view
  [self presentViewController:controller animated:YES completion:nil];
  </code></pre>
  
  <p>When I run the app, it is giving me the following error.</p>
  
  <pre><code>Warning: Attempt to present &lt;UIViewController: 0x751fcd0&gt; on &lt;ViewController: 0x751d7a0&gt; whose view is not in the window hierarchy!
  </code></pre>
  
  <p>What does this mean and where am I going wrong? Shouldn't it display a white view or am I understanding wrong?</p>
  
  <p>Thanks.</p>