gpt4 book ai didi

ios - 同时使用滑动手势和触摸开始/移动/结束

转载 作者:搜寻专家 更新时间:2023-10-30 21:55:37 25 4
gpt4 key购买 nike

我正在尝试在触摸开始/移动/结束时使用滑动手势和一些逻辑。理想情况下,如果:

  • 用户向左/向右滑动,不调用(或取消)触摸开始/移动/结束逻辑。
  • 对于所有其他情况,触摸开始/移动/结束逻辑照常调用。

这可能吗?

我尝试添加以下内容(基于 process both touch event and gesture recognizer )但仍然调用 touches moved/ended:

leftSwipeGestureRecognizer.delaysTouchesBegan = true 
self.leftSwipeGestureRecognizer.cancelsTouchesInView = false

最佳答案

应该是:

self.leftSwipeGestureRecognizer.cancelsTouchesInView = YES

这意味着:如果识别到手势,则取消触摸,否则,触摸开始/移动/结束调用。

来自文档:

When this property is YES (the default) and the receiver recognizes its gesture, the touches of that gesture that are pending are not delivered to the view and previously delivered touches are cancelled through a touchesCancelled:withEvent: message sent to the view. If a gesture recognizer doesn’t recognize its gesture or if the value of this property is NO, the view receives all touches in the multi-touch sequence.

关于ios - 同时使用滑动手势和触摸开始/移动/结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26950367/

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