Question

2 Gesture recognizer:

UIPinchGestureRecognizer *twoFingerPinch = 
[[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
[croppper addGestureRecognizer:twoFingerPinch];

UIPanGestureRecognizer *PanRecognizer = [[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)] autorelease];
[croppper addGestureRecognizer:PanRecognizer];

and:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {        
    return YES;
}   

But pinch and pan at the same time is not working... often i can pinch because the pan recognizer is on.

regards

Was it helpful?

Solution

It doesn't look like you're setting the delegate for each gesture recognizer. gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: is a delegate method, and so if the gesture recognizer has no delegate, this method won't be invoked.

As a result, the default return value will be NO, and so the gestures won't be recognised simultaneously.

OTHER TIPS

Are you setting yourself as the recognisers delegate?

[twoFingerPinch setDelgate:self];
...
[PanRecognizer setDelegate:self];

PS I'd also try to get a more consistent naming scheme for your variables!

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