在触摸进入内容视图之前检测滚动视图上的手指数量

发布于 2024-10-27 12:50:23 字数 177 浏览 4 评论 0原文

我已经在滚动视图中访问 UIGestureRecognizer 数组,并将 maximumNumberOfTouches 设置为 2 以允许我的一个/两个手指滑动/拖动手势自定义滚动视图。 我想做的事情是识别何时是单指拖动和何时是两指拖动。有办法实现这一点吗?

I am already visiting array of UIGestureRecognizer in the scrollview and make maximumNumberOfTouches to be 2 to allow both one/two finger swipe/drag gesture for my custom scrollview.
The thing I want to do is to identify between when it's a one finger drag and when it's a two finger drag. Is there a way to achieve this?

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

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

发布评论

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

评论(2

腻橙味 2024-11-03 12:50:23

UIGestureRecognizer 的方法 -(NSUInteger)numberOfTouches 可以告诉你有多少次触摸。

The method -(NSUInteger)numberOfTouches of UIGestureRecognizer could tell you how many touches on it.

寻找一个思念的角度 2024-11-03 12:50:23
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    int count = [[event allTouches] count]; // this should be 1 or 2
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    int count = [[event allTouches] count]; // this should be 1 or 2
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文