在自定义转换后触摸不到

我在iPad上有自定义转换的问题。 我创build了一个自定义的过渡animation正确,似乎工作(即发生转变)。 但是,当我到达目标视图控制器(执行isLoggedIn块后)时,目标视图控制器无响应(它不响应触摸事件)。 我有一种感觉,它与调用[container insertSubview:toViewController.view belowSubview:fromViewController.view]; 因为如果我调用[container insertSubview:toViewController.view aboveSubview:fromViewController.view]; 触摸按预期工作(但不能看到animation,因为它发生在源视图控制器上)。

任何想法为什么触摸事件不被识别?

 -(void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIView *container = [transitionContext containerView]; //Prepare the view if (self.isLoggedIn) { //Insert the main view under the login view CGRect frame = CGRectMake(0, 0, toViewController.view.frame.size.height, toViewController.view.frame.size.width); toViewController.view.frame = frame; [container insertSubview:toViewController.view belowSubview:fromViewController.view]; } else { CGRect frame = CGRectMake(0, 0, toViewController.view.frame.size.height, toViewController.view.frame.size.width); toViewController.view.frame = frame; if([toViewController respondsToSelector:@selector(openWalls)]) { [(DJVLoginViewController*)toViewController openWalls]; } if([toViewController respondsToSelector:@selector(toggleLoginViewsAlpha:)]) { [(DJVLoginViewController*)toViewController toggleLoginViewsAlpha:0]; } //Insert the login view above the main view [container insertSubview:toViewController.view aboveSubview:fromViewController.view]; } //Make animations [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{ if (self.isLoggedIn) { //Perform animation } else { //Perform animation } } completion:^(BOOL finished) { [transitionContext completeTransition:YES]; }]; } 

尝试从superview中删除fromView:

 [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{ if (self.isLoggedIn) { //Perform animation } else { //Perform animation } } completion:^(BOOL finished) { [fromViewController.view removeFromSuperview]; [transitionContext completeTransition:YES]; }]; }