title: Back to RootViewController from Modal View Controller
body: <p>From Home view - my RootViewController - I open up 2 ViewControllers one after another as user progresses in navigation hierarchy like so:</p>
  
  <p>1) SecondViewController is pushed by button connected in my Storyboard</p>
  
  <p>2) ThirdViewController is presented modally </p>
  
  <pre><code>[self performSegueWithIdentifier:@"NextViewController" sender:nil];
  </code></pre>
  
  <p>So, the picture is:  RootViewController -> SecondViewController -> ThirdViewController</p>
  
  <p>Now in my ThirdViewController I want to have a button to go back 2 times to my RootViewController, i.e. go home. But this does not work:</p>
  
  <pre><code>[self.navigationController popToRootViewControllerAnimated:YES]; 
  </code></pre>
  
  <p>Only this guy goes back once to SecondViewController</p>
  
  <pre><code>[self.navigationController popViewControllerAnimated:YES];
  </code></pre>
  
  <p>How can I remove both modal and pushed view controllers at the same time?</p>