我在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
请问这是为什么? 怎么让两个手势同时执行?
------解决方案--------------------
那就我来接吧
不过为什么要手势覆盖呢