문제

it means user can't pan and pinch simultaneously and pinch gesture stops pan one.

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {

    return YES;
}

This code is not working for me because it makes these gestures working simultaneously.

By default if I don't use this code then pan gesture stops pinch one but I need the opposite thing.

Updated

@interface SomeClass : UIViewController <UIGestureRecognizerDelegate>

...

@end

@implementation SomeClass

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {

        return YES;
    }

@end
도움이 되었습니까?

해결책 2

solved by editing pan gesture handler:

- (IBAction)panGRUsed:(id)sender {

    UIPanGestureRecognizer *gr = (UIPanGestureRecognizer *)sender;
    if (gr.numberOfTouches > 1) {

        [gr setTranslation:CGPointZero inView:self.view];
    } else {

        ...
    }
}

다른 팁

You can create dependencies between recognizers using the requireGestureRecognizerToFail: method so that one gesture will only become eligible to begin when another has failed.

Depending on exactly what you need you may have to subclass and create your own gestures so that you can control how and when they begin and fail.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top