title: iphone modal view - how to go back to parent parent parent controller
body: <p>I have several views that I open one after another modally.  View1 calls View2 and View2 calls View3.<br>
  I use this code to call the next view:</p>
  
  <pre><code>   View2 *myView = [[View2 alloc] initWithNibName:@"View2" bundle:[NSBundle mainBundle]];   
  
      [self presentModalViewController:myView animated:YES];
  
      [myView release];
  </code></pre>
  
  <p>If the user pushes cancel then it goes back one View… 3 to 2 and 2 to 1</p>
  
  <pre><code>[self.parentViewController dismissModalViewControllerAnimated:YES];
  </code></pre>
  
  <p>What I need to do is when the user is on View3 if they don’t select cancel but complete the operation, then I need to go back to View1 and release View2 and View3.</p>
  
  <p>How do I  do that?</p>
  
  <p><strong>EDIT:  The MAIN WINDOW has a Navcontroller and 6 view controllers.  I call the View 1 like this</strong>:</p>
  
  <pre><code>View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];
      self.Search = screen;
  
      [mainNavController presentModalViewController:screen animated:YES];
  
      [screen release];
  </code></pre>
  
  <p><strong>EDIT #2:
  Main Windows calls View 1.  Main Window has a NavController in the XIB this works:</strong></p>
  
  <pre><code>    View1 *screen = [[View1 alloc] initWithNibName:@"View1" bundle:[NSBundle mainBundle]];
  
  
  [mainNavController presentModalViewController:screen animated:YES];
  
  [screen release];
  </code></pre>
  
  <p>Then in the XIB on View 1 I added a NavController and tied it to View1NavController in the .h</p>
  
  <p>View 1 then calls view 2:</p>
  
  <pre><code>   View2 *myView = [[[View2 alloc] initWithNibName:@"View2" bundle:nil] autorelease];
  
  UINavigationController * navController = [[[UINavigationController alloc] initWithRootViewController:myView] autorelease]; 
  
  [View1NavController presentModalViewController:navController animated:YES];
  </code></pre>
  
  <p>When I execute this, no errors, but it doesnt show the View2.</p>