views:

114

answers:

2

Hi,

I want to get a callback when my UIPinchGestureRecognizer finished a pinch-gesture. Moreover it would be great to know if the finished gesture was a zoom in or a zoom out.

Does anyone know a method to use? Or the approach to do?

Thanks!

A: 

You can know if it was a zoom in or out by the scale property of the UIPinchGestureRecognizer.

Just overrride it's touchesEnded: method to get a callback (and the call some other method if you wish).

tadej5553
Thank you! That's exactly what I needed!
Lars Petersen
+2  A: 

Another approach instead of overriding touchesEnded:, is that you could just check the state of the gesture recognizer in your target handler method.

  -(void)handlePinchGesture:(UIGestureRecognizer*)gestureRecognizer {    
    if(UIGestureRecognizerStateEnded == [gestureRecognizer state]){
      // do something
    }
  }
niblha
Thank you! That's even better ;)
Lars Petersen