简体   繁体   English

UIButton单击事件未触发其他子视图

[英]UIButton click event not firing due other subviews

On my SplashScreenViewController , I have a series of sequenced animations that hide and display views via cross-dissolves. 在我的SplashScreenViewController ,我具有一系列序列化的动画,这些动画通过交叉溶解来隐藏和显示视图。 There is also a button that is present throughout to allow the user to skip out of this. 在整个过程中还存在一个按钮,允许用户跳过此按钮。 However, the button is not responding to its touch up inside event. 但是,按钮没有响应其内部触摸事件。 If I tap on it rapidly, sometimes I can get it to fire, but rarely. 如果我快速点击它,有时我会把它开火,但很少。

I assume that this is a result of what I am doing to the other UIViews and that the touch is being absorbed by them. 我认为这是我对其他UIViews所做的操作的结果,并且触摸被它们吸收了。

Each of the other subviews has User Interaction Enabled set to false (unchecked in the IB). 其他每个子视图都将“ User Interaction Enabled设置为false (在IB中未选中)。 The button is presented last in the IB, which should make it the top view. 该按钮位于IB的最后,它应该成为顶视图。 I also add the following code just in case: 我还添加了以下代码以防万一:

_btnAlreadyRegistered.hidden = NO;
[[UIApplication sharedApplication].keyWindow bringSubviewToFront:_btnAlreadyRegistered];
_btnAlreadyRegistered.enabled = YES;

Here is an example of one of the methods that executes the animation. 这是执行动画的方法之一的示例。 Each of the various fade in / fade out animations follows this same pattern: 各种淡入/淡出动画均遵循以下相同模式:

- (void) fadeOutHello {

    _btnAlreadyRegistered.hidden = NO;
    [[UIApplication sharedApplication].keyWindow bringSubviewToFront:_btnAlreadyRegistered];
    _btnAlreadyRegistered.enabled = YES;

    [UIView transitionWithView:[self view]
                      duration:CROSS_FADE_DURATION_3
                       options:UIViewAnimationOptionTransitionCrossDissolve
                    animations:^{_grayView.hidden = YES;}
                    completion:^(BOOL finished){[self fadeInGetRegistered];}
     ];
}

Try UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction 试试UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM