8

2 ジェスチャーレコグナイザー:

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];

と:

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

しかし、同時にピンチしてパンすることはできません...パン認識機能がオンになっているため、ピンチできることがよくあります。

よろしく

4

2 に答える 2

14

各ジェスチャ認識エンジンのデリゲートを設定しているようには見えません。gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:デリゲート メソッドであるため、ジェスチャ レコグナイザーにデリゲートがない場合、このメソッドは呼び出されません。

その結果、デフォルトの戻り値は になりNO、ジェスチャーは同時に認識されません。

于 2011-12-06T16:43:50.807 に答える
0

自分自身を承認者の代理人として設定していますか?

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

PS私はまた、変数のより一貫した命名スキームを取得しようとします!

于 2011-12-06T17:11:43.770 に答える