I had a problem similar to yours where the navigation bar would change after calling [transitionContext completeTransition:YES] based on the visual adjacency of the navigationBar border separating the border with the UIWindow vertex. My navigation bar was nowhere at the top, so it resized to 44 pixels instead of the usual 64px "extended-under-status-bar". To get around this, I just completed the transition before I animated my toViewController alpha and position. That is, as soon as everything was correctly positioned for the animation, I called completeTransition: to let the navigation controller adjust itself while it is invisible. So far this has not had any unforeseen side effects, and the extra alpha version, moving animation frames still continues after you completeTransition .
Here is my animateTransition: method animateTransition: in my presentation animation class, which corresponds to <UIViewControllerAnimatedTransitioning>
UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *presentedViewController = self.presenting ? toViewController : fromViewController; UIView *containerView = [transitionContext containerView]; NSTimeInterval animationDuration = [self transitionDuration:transitionContext]; if (self.presenting) { containerView.alpha = 0.0; presentedViewController.view.alpha = 0.0; [containerView addSubview:presentedViewController.view]; [UIView animateWithDuration:animationDuration delay:0 options:kNilOptions animations:^{ containerView.alpha = 1.0; } completion:^(BOOL finished) { presentedViewController.view.frameTop += 20;
I hope this helps anyone who is in my position!
source share