这意味着用户不能同时平移和捏合,并且捏合手势停止平移一。
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
这段代码对我不起作用,因为它使这些手势同时工作。
默认情况下,如果我不使用此代码,则平移手势会停止捏一个,但我需要相反的东西。
更新
@interface SomeClass : UIViewController <UIGestureRecognizerDelegate>
...
@end
@implementation SomeClass
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
@end