title: iOS: remove view controller from navigation stack
body: <p>I have a navigation based app that requires a passcode to view some pages. When I am on <strong>Controller A</strong> I want to push to the <strong>Passcode Controller</strong> then push to <strong>Controller B</strong> and remove the <strong>Passcode Controller</strong> from the stack. </p>
  
  <p>So to be clear, <strong>Passcode Controller</strong> is stuck in between <strong>Controller A</strong> and <strong>Controller B</strong> and I do not know how to remove it.</p>
  
  <p>I've tried two different approaches but neither is giving me the right result.</p>
  
  <p><strong>Attempt 1:</strong></p>
  
  <pre><code>ControllerB *contB = [self.storyboard instantiateViewControllerWithIdentifier:@"contB"];
  [self.navigationController pushViewController:contB animated:YES];
  
  [self.navigationController popViewControllerAnimated:NO];
  </code></pre>
  
  <p><strong>Attempt 2:</strong></p>
  
  <pre><code>ControllerB *contB = [self.storyboard instantiateViewControllerWithIdentifier:@"contB"];
  
  ControllerA *contA = [self.storyboard instantiateViewControllerWithIdentifier:@"contA"];
  
  [UIView transitionFromView:contA.view
                    toView:contB.view
                    duration:0.65f
                    options:(UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionTransitionCrossDissolve)
                    completion:^(BOOL finished){
                          self.view.window.rootViewController = contA;
                      }];
  </code></pre>
  
  <p>Does anyone know how I can remove <strong>Passcode Controller</strong> from the stack whenever I push <strong>Controller B</strong> from the <strong>Passcode Controller</strong>?</p>