我有一个包含各种类型子视图的视图。在某一时刻,我想禁用与视图和子视图的所有交互,并从我放置在整个视图上的手势识别器中注册点击:
tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:revealController action:@selectorrdoSomething:)];
tapGestureRecognizer.cancelsTouchesInView = YES;
虽然它有点工作,但下面的视图仍然与所有触摸交互。然后我尝试添加:
tapGestureRecognizer.delaysTouchesBegan = YES;
tapGestureRecognizer.delaysTouchesEnded = YES;
它现在可以工作了——当我点击 UITextField 时,它会接收手势识别器的触摸 INSTEAD。这是为什么,我该如何阻止它?任何帮助深表感谢 :)