如何将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;
}
}