gpt4 book ai didi

ios - 如何忽略 UIGestureRecognizer 触摸?

转载 作者:可可西里 更新时间:2023-11-01 04:22:39 24 4
gpt4 key购买 nike

<分区>

我正在使用 UIGestureRecognizer 来捕捉点击...如果我不想处理特定的点击,手册上说:

"If a gesture recognizer detects a touch that it determines is not part of its gesture, it can pass the touch directly to its view. To do this, the gesture recognizer calls ignoreTouch:forEvent: on itself, passing in the touch object."

不幸的是,我找不到任何使用它的例子。这是我在 UIGestureRecognizer 处理程序中的代码:

- (void)singleFingerTap:(UITapGestureRecognizer*)gesture {

CGPoint pt = [gesture locationInView:self.view];
CGRect dataRect = CGRectMake(117.0,416.0,670.0,1450);
CGPoint dataPoint = CGPointMake(pt.x, pt.y);

// check to see if point is within the rectangle
if(!CGRectContainsPoint(dataRect, dataPoint)) {
NSLog(@"\n\nNOT within subViewData (x: %f y: %f",dataPoint.x, dataPoint.y);
[self.view ignoreTouch:gesture];
}
else {
NSLog(@"\n\nIS within subViewData(x: %f y: %f",dataPoint.x, dataPoint.y);
}
}

我一直收到错误:

No visible @interface for 'UIView' declares the selector 'ignoreTouch:'

我已经阅读了 App 文档,他们有我引用的内容; SO 或 Google 上没有任何内容可以回答这个问题。非常感谢帮助(像往常一样)。 :D

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com