title: How do I reset a UINavigationController?
body: <p>I have a problem involving the UINavigationController.</p>
  
  <p>I have a application that have three view controllers that I'm switching between using the navigation controllers push and pop functionality. </p>
  
  <p>The problem is this:
  I stand in the third view controller and makes a call to 
  <br>[self.navigationController popToRootViewControllerAnimated:YES];
  <br>this brings me to the first view controller (which is exactly what I want) but when I then try to navigate to the second view controller I end up in the third for some reason.</p>
  
  <p>Is there any way you can reset the navigation controller, or am I doing this the wrong way?</p>
  
  <p>Here is the code that I'm using to push and pop the navigation controller:</p>
  
  <p><strong>The following code is called in the root view controller when the user decides to launch the camera.</strong></p>
  
  <pre><code>if(self.cameraViewController == nil)
  {
          CollageCameraViewController *camView = [[CollageCameraViewController alloc] init];//WithNibName:nil bundle:[NSBundle mainBundle]];
          self.cameraViewController = camView;
          [camView release];
  
  }
  [self.navigationController pushViewController:self.cameraViewController animated:NO];
  </code></pre>
  
  <p><strong>The following code is called from CollageCameraViewController (second) after the user has taken his fotos:</strong></p>
  
  <pre><code>if(self.renderView == nil)
  {
      CollageRenderViewController *renderViewController = [[CollageRenderViewController alloc] initWithNibName:nil bundle:[NSBundle mainBundle]];
      self.renderView = renderViewController;
      [renderViewController release];
  }
  [self.navigationController pushViewController:self.renderView animated:YES];
  </code></pre>
  
  <p><strong>The following code is called from CollageRenderViewController when the user decides to go back to main (root) view:</strong></p>
  
  <pre><code>[self.navigationController popToRootViewControllerAnimated:YES];
  </code></pre>
  
  <p>Now, if I try to push CollageCameraViewController again I end up in CollageRenderViewController instead, why is that?</p>
  
  <p>Cheers,
  Andreas</p>