iOS 自定义Present转场动画,Dismiss后黑屏

黑屏.gif

出现这个黑屏的三个点:

  1. FromVC设置了transitioningDelegate (UIViewControllerTransitioningDelegate)
  2. FromVC.modalPresentationStyle = UIModalPresentationCustom
  3. Dismiss
-(void)animateTransition:(id)transitionContext{
    ...
    [containerView addSubview:toVC.view];
    ...
}

Fix:

-(void)animateTransition:(id)transitionContext{
    ...
    if (fromVC.modalPresentationStyle == UIModalPresentationFullScreen) {
        [containerView addSubview:toVC.view];
    }
    ...
}
violet.jpg

你可能感兴趣的:(iOS 自定义Present转场动画,Dismiss后黑屏)