Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在手势识别器中更改UIView userInteractionEnabled无效_Ios_Uiview_Uigesturerecognizer - Fatal编程技术网

Ios 在手势识别器中更改UIView userInteractionEnabled无效

Ios 在手势识别器中更改UIView userInteractionEnabled无效,ios,uiview,uigesturerecognizer,Ios,Uiview,Uigesturerecognizer,我想在UIPanGestureRecognizer回调期间更改UIView。例如: - (void)handleScroll:(UIPanGestureRecognizer *)recognizer if (recognizer.state == UIGestureRecognizerStateBegan){ self.subview.userInteractionEnabled = NO; } else if (recognizer.state == UIGes

我想在UIPanGestureRecognizer回调期间更改UIView。例如:

- (void)handleScroll:(UIPanGestureRecognizer *)recognizer
    if (recognizer.state == UIGestureRecognizerStateBegan){
        self.subview.userInteractionEnabled = NO;
    } else if (recognizer.state == UIGestureRecognizerStateEnded){
        self.subview.userInteractionEnabled = YES;
    }
}
这在UIPangestureRecognitor回调中从未起作用,但如果我在initWithFrame方法中编写代码,它确实起作用

我还尝试在回调中使用performSelectorOnMainThread:withObject:waitUntilDone:,但都不起作用


在手势识别器回调中不能执行的操作是否有任何限制?

我在UIGestureRecognitor中将CancelsTouchesView意外设置为否。将其更改为“是”解决了问题。

检查语句self.userInteractionEnabled=NO的顺序@AshokLondhe因此,当识别开始时,我想禁用所有子视图的交互,在识别结束后,我希望它们返回。订单是我期望的。你有什么特别的意思吗?如果你使用这个if-recognizer.state==UIgestureCongnizerStateStarted{self.userInteractionEnabled=NO;}它永远不会工作。。。不是“否”,而是“写是”。我更新了问题,现在在子视图中更改了,但即使这样也不适用于我。你使用的是什么类型的用户交互函数。上面的代码适用于我。我尝试了使用按钮