I have a custom transition between view controllers built into the UINavigationController , which works great when building with iOS 7/8, but is not the correct layout when it is built against the iOS 9 SDK.
- (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; [transitionContext.containerView addSubview:toViewController.view]; ...
Then it continues and performs the animation. The problem is that the contents of the toViewController , even if it uses the layout restriction of the layout of the top right top sheet, represents the content located behind the navigation bar.
However, it works fine on iOS 8, and if we force redraw (for example, send the application to the background and return it, present the modal on top and turn it off, etc.), this will cause the entire system to automatically the layout will redraw itself and toViewController see the transitions to the desired location (as the top placement guide, x pixels from the navigation bar, not x pixels from the top of the deviceβs screen).
Adding
[self.view setNeedsUpdateConstraints]; [self.view layoutIfNeeded];
It works if it is placed in viewDidAppear:animated , but does not work on viewDidLoad or viewWillAppear:animated . This is not a solution, as users will see a jump in the view when redrawing occurs in viewDidAppear:animated
ios ios9 uinavigationcontroller custom-transition
Edgar Sep 24 '15 at 10:43 2015-09-24 10:43
source share