我如何将其UIPinchGestureRecognizer
用于多种用途?目前我正在使用它来放大/缩小我的 GLKView,但我想使用手势来移动(平移/倾斜),但同时能够缩放。我在 iOS 上的许多 CAD 和 3D 应用程序中都看到了这种行为。
捏合代码:
- (void)pinchDetected:(UIPinchGestureRecognizer *)pinchRecognizer
{
NSLog (@"%@", @"Pinching");
if (pinchRecognizer.state == UIGestureRecognizerStateBegan ||
pinchRecognizer.state == UIGestureRecognizerStateChanged ||
pinchRecognizer.state == UIGestureRecognizerStateEnded) {
_zoom += (-1)*(logf(pinchRecognizer.scale) * 10.0f);
pinchRecognizer.scale = 1.0;
}
}