1. If I switch Tab at a normal speed, there will be no problem. If I switch fast (very fast, otherwise there will be no problem), the tab, will have a blank page, that is, the navigation views in the Tab will be missing, and then I will break the point. After watching for a long time, I find that if the transitionContext.containerView is gone for a long time, that is, = = nil, and transitionContext.containerView is the container for animation
.2. Transition animation is usually performed in the-(void) animateTransition: (id < UIViewControllerContextTransitioning >) transitionContext {} method
3. Key code:
fromViewController.view.frame = fromFrame;
toViewController.view.frame = CGRectOffset(toFrame,
toFrame.size.width * offset.dx * -1,
toFrame.size.height * offset.dy * -1);
transitionContext.containerView.backgroundColor = [UIColor redColor];
[transitionContext.containerView addSubview:toViewController.view];
NSTimeInterval transitionDuration = [self transitionDuration:transitionContext];
NSLog(@"PPPPPPPPPP+%@",transitionContext.containerView);
[UIView animateWithDuration:transitionDuration animations: ^ {
fromViewController.view.frame = CGRectOffset(fromFrame,
fromFrame.size.width * offset.dx,
fromFrame.size.height * offset.dy);
toViewController.view.frame = toFrame;
toViewController.view.backgroundColor = [UIColor blueColor];
} completion:^(BOOL finished)
{
[transitionContext completeTransition:![transitionContext transitionWasCancelled]];
NSLog(@"===========%@",transitionContext.containerView);
}];
4. If there is a big god knows, guide one or two, thank you