title: iOS: custom segue and presentViewController not working as expected
body: <p>I'm using a custom segue which looks like this:</p>
  
  <p>@implementation ModalPushSegue</p>
  
  <pre><code>- (void)perform {
      UIViewController *fromController = self.sourceViewController;
      UIViewController *toController = self.destinationViewController;
      UIView *fromView = fromController.view; 
      UIView *toView = toController.view; 
  
      CGPoint centerStage = toView.centerStage;
      toView.center = toView.rightStage;
  
      [fromView.window addSubview:toView];
      [fromController addChildViewController:toController];
  
      [UIView transitionWithView:toView 
                        duration:0.5 options:0
                      animations:^{
                          toView.center = centerStage;
                      }
                      completion:nil];
  
  }
  </code></pre>
  
  <p>This works well in that the view is slide on from the right as expected and the controller is added to the controller hierarchy. </p>
  
  <p>But later in the added controller I do this:</p>
  
  <pre><code>[self presentViewController:anotherController animated:YES completion:nil];
  </code></pre>
  
  <p>I would expect this to slide the new controller's view up the screen ala modal style. But what happens instead is the the new view doesn't appear. And when I later remove this controller, it's view flashes up and slides off the screen, leaving a black background instead of the view that was originally there. </p>
  
  <p>I've been playing around with this for a while and if I change the code to </p>
  
  <pre><code>//[self presentViewController:oauthController animated:YES completion:nil];
  [self.view addSubview:oauthController.view];
  [self addChildViewController:oauthController];
  </code></pre>
  
  <p>Then the view appears as expected, although not resized.</p>
  
  <p>My problem appears to be with the way that the segues setup the hierarchy vs the way that <code>presentViewController</code> does things. I've done lots of reading and searching but so far have not been able to get a clear picture of exactly what is going on. </p>
  
  <p>I've also played around with using <code>presentViewController</code> in the segue but instead of laying the new view over the old one, the screen goes black and the new view then slides on.</p>
  
  <p>Any help appreciated.</p>