title: Setting navigationController.viewControllers messes up the stack later
body: <p>I run into a weird issue.
  When setting <code>navigationController.viewControllers</code> to a new array whose <code>viewControllers</code> equal to the current <code>UIViewController.viewControllers</code>, then trying to segue to a new <code>viewController</code> (push segue), the <code>UIViewController.viewControllers</code> is messed up.</p>
  
  <p>To be exact,
  I did the following:</p>
  
  <pre><code>-(void)viewWillAppear:(BOOL)animated
  {
  ...
      for(int i=0; i&lt;[self.navigationController.viewControllers count]; i++)
      {
          NSLog(@"Befor: %d: %@",i, [[self.navigationController.viewControllers objectAtIndex:i] description]);
      }
      [[self navigationController] setViewControllers:[NSArray arrayWithObjects:[self.navigationController.viewControllers objectAtIndex:0], self,nil] animated:NO];
      NSLog(@"After: Num of view controllers: %d", [self.navigationController.viewControllers count]);
      for(int i=0; i&lt;[self.navigationController.viewControllers count]; i++)
      {
          NSLog(@"After: %d: %@",i, [[self.navigationController.viewControllers objectAtIndex:i] description]);
      }
  
  }
  </code></pre>
  
  <p>Log results: </p>
  
  <blockquote>
    <p>Befor: Num of view controllers: 2 2014-02-15    17:15:01.144[827:60b] Befor: 0:     2014-02-15 17:15:01.145[827:60b] Befor: 1:  2014-02-15 17:15:01.147[827:60b] After: Num of view    controllers: 2 2014-02-15 17:15:01.148[827:60b] After: 0:     2014-02-15 17:15:01.149[827:60b]    After: 1: </p>
  </blockquote>
  
  <p>Then I pushed a button that segues to another viewController.
  Just before the segue this code called:</p>
  
  <pre><code>-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
      NSLog(@"prepareForSegue: Num of view controllers: %d", [self.navigationController.viewControllers count]);
      for(int i=0; i&lt;[self.navigationController.viewControllers count]; i++)
      {
          NSLog(@"prepareForSegue: %d: %@",i, [[self.navigationController.viewControllers objectAtIndex:i] description]);
      }
  ...
  
  }
  </code></pre>
  
  <p>Log results:</p>
  
  <blockquote>
    <p>2014-02-15 17:15:05.388[827:60b] prepareForSegue: Num of view controllers: 1
    2014-02-15 17:15:05.389[827:60b] prepareForSegue: 0: </p>
  </blockquote>
  
  <p>I monitored the <code>navigationController.viewControllers</code> at the destination <code>viewController</code> and it seems that the <code>rootViewController</code> vanished.
  When trying to go back (using the navigation controller back button), things got ugly.</p>
  
  <p>I noticed that all this stuff doesn't happen when I assign an array whose objects are different from the current <code>navigationController.viewControllers</code>, so it's a workaround for now.</p>
  
  <p>Did I do something wrong?</p>