如何一次处理多个触摸手势? [英] How to handle multiple touch gesture at a time?

查看:95
本文介绍了如何一次处理多个触摸手势?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须一次在我的imageview上执行所有手势,这意味着用户可以在双击时一次单击来移动imageview,还可以缩放和旋转.现在,我发现这种方法可以执行多个操作手势,但无法执行缩放和旋转.

I have to perform all the gesture on my imageview at a time, means user can move imageview on single tap at a time on double tap also zooming and rotation possible.Now i am found this methods to perform multiple gesture but unable to perform zoom and roation.

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event

在应用UIPinchGestureRecognizerUIRotationGestureRecognizerUIPanGestureRecognizer之前,它一次只能处理一个手势.请帮助我解决此问题,或者尽可能提供其他更好的选择.

Before i am applied UIPinchGestureRecognizer,UIRotationGestureRecognizer and UIPanGestureRecognizer but it handle only one gesture at a time.Please help me to solve this or give me any other better option if possible.

推荐答案

UIPinchGestureRecognizer *pinchGesture = ... //initialize
pinchGesture.delegate = self;
//same for rotation gesture
//and then implement delegate method
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer 

这篇关于如何一次处理多个触摸手势?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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