同一个UIImage上的多个手势识别器

时间:2012-06-20 11:15:04

标签: ios uigesturerecognizer

我正在尝试将2个手势添加到拉动子视图的uiimage中。一个手势是滑动打开/关闭。另一种是长按并保持在特定高度打开它。

longPress.minimumPressDuration = 1;
[imageNavigationSlider addGestureRecognizer:longPress];

UILongPressGestureRecognizer *longPressWall = [[[UILongPressGestureRecognizer alloc]
                                            initWithTarget:self     action:@selector(handleLongPressWall:)] autorelease];
longPressWall.minimumPressDuration = 1;
PullMeImage.userInteractionEnabled=YES;
[PullMeImage addGestureRecognizer:longPressWall];

UISwipeGestureRecognizer *swipe = [[[UISwipeGestureRecognizer alloc] initWithTarget:self     action:@selector(swipe:)] autorelease];
swipe.direction = UISwipeGestureRecognizerDirectionLeft |     UISwipeGestureRecognizerDirectionRight;
[PullMeImage addGestureRecognizer:swipe];
[swipe setDelegate:self];

正确识别长按手势,但滑动不正确。

我也尝试过使用:

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

但没有成功。任何帮助将非常感谢。

谢谢

0 个答案:

没有答案