我已将以下手势识别器添加到我的用户控件中:
UIRotationGestureRecognizer *rotate = [[UIRotationGestureRecognizer alloc]
initWithTarget:self
action:@selector(ViewRotated:)];
[[self view] addGestureRecognizer:rotate];
-(void)ViewRotated:(UIRotationGestureRecognizer *)sender{
NSLog(@"rotated");
}
到目前为止,一切都很好,每当我在 iOS 设备上旋转手指时,手势都会快速响应。
现在,将捏合手势识别器添加到同一视图时,问题就来了。当我添加:
UIPinchGestureRecognizer* pch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(ViewPinched:)];
[[self view] addGestureRecognizer:pch];
//...
// ...
-(void)ViewPinched:(UIPinchGestureRecognizer *)sender{
NSLog(@"Pinched");
}
该 pch 事件在 70% 的时间内触发。我必须以完美的方式真正旋转我的手指,以便触发旋转手势而不是捏合手势。如何使旋转手势更明智,以便更容易触发?