swipeGesture、touchMoved 被同时调用吗?

发布于 2024-10-09 16:18:55 字数 314 浏览 0 评论 0原文

我想在 SwipeGesture 和 TouchMoved 中执行不同的操作。但是两者都被称为 当我们刷卡时。有什么帮助吗?

 Drecoginizer  = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFromD:)];
Drecoginizer.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:Drecoginizer];

i want to do different operation in SwipeGesture and TouchMoved.But both are called
when we swipe.any help please?

 Drecoginizer  = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipeFromD:)];
Drecoginizer.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:Drecoginizer];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谜兔 2024-10-16 16:18:55

据我了解,如果此滑动位于圆圈之外,您不希望选择器对滑动手势做出反应。在这种情况下,在滑动选择器的开头,您应该检查滑动是否在圆圈上方,如下所示:

CGPoint lClick = [recognizer locationOfTouch:0 inView:self.view];

    //Distance from the center of the circle to the taped point
    int lDistance = sqrt(pow(lClick.x - lCircleCenter.x, 2) + pow(lClick.y - lCircleCenter.y, 2));

    if ((int)lDistance > (int)lCircleRadius) {
        return;
    }

希望它对您有帮助

As I understood you do not want the selector to react on swipe gesture if this swipe is outside of the circle. In this case, in the beginning of the swipe selector you should check if the swipe is over the circle something like so:

CGPoint lClick = [recognizer locationOfTouch:0 inView:self.view];

    //Distance from the center of the circle to the taped point
    int lDistance = sqrt(pow(lClick.x - lCircleCenter.x, 2) + pow(lClick.y - lCircleCenter.y, 2));

    if ((int)lDistance > (int)lCircleRadius) {
        return;
    }

Hope it helps you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文