1.首先排除表格的父试图是否能交互(userInteractionEnabled);
2.其次排除表格是否能交互(userInteractionEnabled);
3.再次排查表格是否被其它透明可交互控件遮盖(Xcode强大的多视图立体分层显示View UI Herarchy)。
4.是否表格超过父试图的范围(Xcode强大的多视图立体分层显示View UI Herarchy)。
5.若以上都没有问题,那么很可能是你的表格的父试图设置了手势,手势的优先级高于表格点击事件。在容器页面(一个容器包含多个控制器页面)更容易出现该问题。
首先设置动画的可交互属性:UIViewAnimationOptionAllowUserInteraction或UIViewKeyframeAnimationOptionAllowUserInteraction。removedOnCompletion设置为NO
[UIView beginAnimations:@"Marquee" context:NULL]; //动画时长 [UIView setAnimationDuration:2.0]; //动画节奏 [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut|UIViewAnimationOptionAllowUserInteraction]; //重复次数 [UIView setAnimationRepeatCount:1]; self.decribeImageView.alpha = 1.0; self.describeTitleLabel.alpha = 1.0; [UIView animateKeyframesWithDuration: 5.0 delay: 0 options: UIViewKeyframeAnimationOptionCalculationModeLinear|UIViewKeyframeAnimationOptionAllowUserInteraction animations: ^{ self.decribeImageView.frame = CGRectMake(self.decribeImageViewEdge+FULL_WIDTH, self.decribeImageViewTop, SCREEN_WIDTH -self.decribeImageViewEdge*2, self.decribeImageViewHeight*FULL_WIDTH/375); [UIView addKeyframeWithRelativeStartTime: 0 relativeDuration: 1.0/(5*4) animations: ^{ self.decribeImageView.frame = CGRectMake(self.decribeImageViewEdge, self.decribeImageViewTop, SCREEN_WIDTH -self.decribeImageViewEdge*2, self.decribeImageViewHeight*FULL_WIDTH/375); }]; [UIView addKeyframeWithRelativeStartTime: (1 - 1.0/(5*4) - 0.001) relativeDuration: 1.0/(5*4) animations: ^{ self.decribeImageView.frame = CGRectMake(-self.decribeImageViewEdge-FULL_WIDTH, self.decribeImageViewTop, SCREEN_WIDTH -self.decribeImageViewEdge*2, self.decribeImageViewHeight*FULL_WIDTH/375); }]; [UIView addKeyframeWithRelativeStartTime: (1 - 0.001) relativeDuration:0.001 animations: ^{ self.decribeImageView.alpha = 0; self.describeTitleLabel.alpha = 0; }]; } completion:^(BOOL finished) { [self removeFromSuperview]; }]; CAAnimationGroup *group = [[CAAnimationGroup alloc] init]; CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; animation.values = @[@0.0, @1.0, @1.0]; animation.keyTimes = @[[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.5], [NSNumber numberWithFloat:1.0]]; CAKeyframeAnimation * opacityAnimation = [CAKeyframeAnimation animation]; opacityAnimation.keyPath = @"opacity"; opacityAnimation.values = @[@0.0, @1.0]; group.animations = @[animation, opacityAnimation]; group.duration = 2.0; group.delegate = self; group.repeatCount = 1.0; group.removedOnCompletion = NO; group.fillMode = kCAFillModeForwards; group.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; [self.diceAnimatedImageView.layer addAnimation:group forKey:@"diceAnimatedImageViewAnimation"];
若还不行就在动画控件上增加一个透明按钮,添加按钮事件。