title: UINavigationController popToRootViewController, and then immediately push a new view
body: <p>I have a tabBarController with two tabs, first of which contains an instance of NavigatorController.  The navigatorController is initiated with a custom viewController "peersViewController" that list all the network peers on a tableView.  Upon selecting a peer, an instance of "FilesListViewController"  (which list files in the c:\ directory) is pushed into the navigationController stack.  </p>
  
  <p>In this filesListViewController I have a button to let it navigate to say documents directory.  To do this I'd wired the interface to call a gotoDirectory:(NSString*)path method in the rootViewController:</p>
  
  <pre><code>- (void)gotoDirectory:(NSString*)path {
       [[self navigationController] popToRootViewControllerAnimated:YES];
       NSArray *files = [self getFilesFromPeerAtPath:path];
       FilesListViewController *filesVC = [[FilesListViewController alloc] initWithFiles:files];
       [[self navigationController] pushViewController:filesVC animated:YES];
       [filesVC release];
  }
  </code></pre>
  
  <p>However, when I press that button, the navigationController did pop my view to the root view controller, but then the FilesListViewController that I instantiated did not appear.  From the log, I know that the custom initWithFiles method was indeed called and network stuffs did happen to get the file names.</p>
  
  <p>Something else is screwy about this.  I tried clicking on the second tab and then click back to the first tab, and huala! the file names I needed are there.  It looks like the data and the filesListViewController was indeed pushed into the navigatorController stack, but the display was not refreshed but stuck at the screen of rootViewController (peersViewController).</p>
  
  <p>Am I doing anything wrong?</p>
  
  <p>--Ben.</p>
  
  <p>-- Edited like 15 minutes after posting the question.  I'd found a workaround, but it bothers me that pop and then push doesn't work.</p>
  
  <pre><code>- (void)gotoDirectory:(NSString*)path {
       PeersListViewController *rootViewController = (PeersListViewController*)[[[self navigationController] viewControllers] objectAtIndex:0];
       [[self navigationController] setViewControllers:[NSArray arrayWithObject:rootViewController]];
       FilesListViewController *filesVC = [[FilesListViewController alloc] initWithFiles:files];
       [[self navigationController] pushViewController:filesVC animated:YES];
       [filesVC release];
  }
  </code></pre>
  
  <p>It doesn't seem like the navigationController should be circumvented this way, and I'd probably have to release all the viewControllers that were in the original stack.  This does however work on the iphone 3.0 simulator. </p>
  
  <p>If I'm using this code though, how should the memory release be handled? should I get the original NSArray of viewcontrollers and release everything?</p>