Question

How do i use the UIPinchGestureRecognizer for multiple purposes? At the moment i am using it to zoom in/out of my GLKView, but i would like to use the gesture to move around (pan/tilt), but at the same time being able to zoom. I have seen this behaviour in many CAD and 3D App's on iOS.

Code for pinching:

- (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;
    }
}
Was it helpful?

Solution

Please see this example for more guidance as this example shows what you want to do as it provide all you need to do simultaneous execution of zoom,pan and also tilt see this

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top