title: Navigation controller top layout guide not honored with custom transition
body: <p>Short version: </p>
  
  <p>I am having a problem with auto layout top layout guide when used in conjunction with custom transition and <code>UINavigationController</code> in iOS7. Specifically, the constraint between the top layout guide and the text view is not being honored. Has anyone encountered this issue?</p>
  
  <hr>
  
  <p>Long version:</p>
  
  <p>I have a scene which has unambiguously define constraints (i.e. top, bottom, left and right) that renders a view like so:</p>
  
  <p><img src="https://i.stack.imgur.com/9h6bP.png" alt="right"></p>
  
  <p>But when I use this with a custom transition on the navigation controller, the top constraint to the top layout guide seems off and it renders is as follows, as if the top layout guide was at the top of the screen, rather than at the bottom of the navigation controller:</p>
  
  <p><img src="https://i.stack.imgur.com/Hz5Pd.png" alt="wrong"></p>
  
  <p>It would appear that the "top layout guide" with the navigation controller is getting confused when employing the custom transition. The rest of the constraints are being applied correctly. And if I rotate the device and rotate it again, everything is suddenly rendered correctly, so it does not appear to be not a matter that the constraints are not defined properly. Likewise, when I turn off my custom transition, the views render correctly.</p>
  
  <p>Having said that, <code>_autolayoutTrace</code> is reporting that the <code>UILayoutGuide</code> objects suffer from <code>AMBIGUOUS LAYOUT</code>, when I run:</p>
  
  <pre><code>(lldb) po [[UIWindow keyWindow] _autolayoutTrace]
  </code></pre>
  
  <p>But those layout guides are always reported as ambiguous whenever I look at them even though I've ensured that there are no missing constraints (I've done the customary selecting of view controller and choosing "Add missing constraints for view controller" or selecting all of the controls and doing the same for them).</p>
  
  <p>In terms of how precisely I'm doing the transition, I've specified an object that conforms to <code>UIViewControllerAnimatedTransitioning</code> in the <code>animationControllerForOperation</code> method:</p>
  
  <pre><code>- (id&lt;UIViewControllerAnimatedTransitioning&gt;)navigationController:(UINavigationController *)navigationController
                                    animationControllerForOperation:(UINavigationControllerOperation)operation
                                                 fromViewController:(UIViewController*)fromVC
                                                   toViewController:(UIViewController*)toVC
  {
      if (operation == UINavigationControllerOperationPush)
          return [[PushAnimator alloc] init];
  
      return nil;
  }
  </code></pre>
  
  <p>And</p>
  
  <pre><code>@implementation PushAnimator
  
  - (NSTimeInterval)transitionDuration:(id &lt;UIViewControllerContextTransitioning&gt;)transitionContext
  {
      return 0.5;
  }
  
  - (void)animateTransition:(id&lt;UIViewControllerContextTransitioning&gt;)transitionContext
  {
      UIViewController* toViewController   = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
      UIViewController* fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];
  
      [[transitionContext containerView] addSubview:toViewController.view];
      CGFloat width = fromViewController.view.frame.size.width;
  
      toViewController.view.transform = CGAffineTransformMakeTranslation(width, 0);
  
      [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{
          fromViewController.view.transform = CGAffineTransformMakeTranslation(-width / 2.0, 0);
          toViewController.view.transform = CGAffineTransformIdentity;
      } completion:^(BOOL finished) {
          fromViewController.view.transform = CGAffineTransformIdentity;
          [transitionContext completeTransition:![transitionContext transitionWasCancelled]];
      }];
  }
  
  @end
  </code></pre>
  
  <p>I've also done a rendition of the above, setting the <code>frame</code> of the view rather than the <code>transform</code>, with the same result.</p>
  
  <p>I've also tried manually make sure that the constraints are re-applied by calling <code>layoutIfNeeded</code>. I've also tried <code>setNeedsUpdateConstraints</code>, <code>setNeedsLayout</code>, etc.</p>
  
  <p>Bottom line, has anyone successfully married custom transition of navigation controller with constraints that use top layout guide?</p>