Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pan and 2 Finger Pinch simultaneous iOS -at the same time-

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

like image 755
Phil Avatar asked Dec 06 '11 16:12

Phil


1 Answers

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.

like image 148
Stuart Avatar answered Sep 22 '22 17:09

Stuart