title: Refresh UINavigationController?
body: <p>I have a <code>UINavigationController</code> with two <code>ViewControllers</code> on the stack. At a certain point in the program execution, the second view controller is visible on the screen and at that moment, I would like to replace that <code>ViewController</code> with another. However, it's not working. Here is my code:</p>
  
  <pre><code>UINavigationController * thisNavController = self.waitingController;
  
  // remove the Dummy and set the new page instead
  NSMutableArray * newControllers = [NSMutableArray arrayWithArray: thisNavController.viewControllers];
  [newControllers replaceObjectAtIndex: ([thisNavController.viewControllers count] - 1) withObject: page];
  NSLog (@"visible before: %@", [thisNavController.visibleViewController description]);
  [thisNavController setViewControllers: [NSArray arrayWithArray: newControllers] animated: YES];
  NSLog (@"visible after: %@", [thisNavController.visibleViewController description]);
  [thisNavController.visibleViewController.view setNeedsDisplay];
  </code></pre>
  
  <p>The above code produces this output:</p>
  
  <pre><code>2011-05-05 13:30:22.201 myApp[3286:207] visible before: &lt;DummyViewController: 0x4c8b4c0&gt;
  2011-05-05 13:30:22.209 myApp[3286:207] visible after: &lt;RealViewController: 0x60173f0&gt;
  </code></pre>
  
  <p>But what is shown on the screen does not change. It seems that everything works fine after I switch tabs, so it seems that it is a redrawing problem, but setNeedsDisplay does nothing and I couldn't find a method that tells the <code>NavigationController</code> that its <code>viewControllers</code> have changed.</p>
  
  <p>Is there some refresh mechanism that I have to trigger to refresh the screen? </p>