ios在对象处理的同时识别手势 [英] ios recognizing gestures simultaneously with object handling

查看:226
本文介绍了ios在对象处理的同时识别手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与UIKit对象进行交互时,是否可以同时识别手势和触摸.例如,当用户在滑块或Pickerview中滚动时,我是否也可以处理滑动手势?

Is it possible to recognize gestures and touches simultaneously when interacting with a UIKit object. For example, when a user is scrolling through a slider or pickerview, could I also be handling a swipe gesture?

推荐答案

如果将视图控制器设置为手势的委托,则可以实现:

If you set your view controller to be the delegate of your gestures, you can implement:

- (BOOL) gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer

我不确定您是否还试图让视图单独处理触摸事件,但是如果您愿意,我建议将UIGestureRecognizer子类化并在那里处理触摸事件.

I'm not sure if you're also trying to have the view handle touch events separately, but if you are, I'd recommend subclassing UIGestureRecognizer and handle touch events there.

这篇关于ios在对象处理的同时识别手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆