1

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;
    }
}
JavaCake
  • 4,075
  • 14
  • 62
  • 125

1 Answers1

2

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

The iOSDev
  • 5,237
  • 7
  • 41
  • 78
  • Does it make any difference that i use the `UIPinchGestureRecognizer` in contrast to the touch events in the particular code sample you linked to? – JavaCake May 29 '12 at 15:38
  • nop it doesn't make any difference other than some coding and calling of functions – The iOSDev May 29 '12 at 15:56