首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

! 多个手势如何同时进行?

2012-03-09 
!!! 多个手势怎么同时进行??我在controller中添加了两个手势:C/C++ codeUIGestureRecognizer *recognizer

!!! 多个手势怎么同时进行??
我在controller中添加了两个手势:
 

C/C++ code
UIGestureRecognizer *recognizer;    recognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleRotation:)];    recognizer.cancelsTouchesInView = NO;    [self.scrollView addGestureRecognizer:recognizer];    [recognizer release];        UIGestureRecognizer *recognizer2;    recognizer2 = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];    recognizer2.cancelsTouchesInView = NO;    [self.scrollView addGestureRecognizer:recognizer2];    [recognizer2 release];


发现每次只能进入Pinch的手势,无法进入Rotation的手势。如果只添加一个,是都可以执行的。
我在Controller中添加了
C/C++ code
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{    return YES;}

但发现没有执行。于是在scrollView中添加同样的代码。虽然执行了,但效果还是一样。Pinch和Rotation这两个手势没有同时执行。都是只执行Pinch后没有执行Rotation
请问这是为什么? 怎么让两个手势同时执行?

[解决办法]
那就我来接吧

不过为什么要手势覆盖呢

热点排行