iphone的手势识别功能存在问题



我知道在ios中处理手势,但是有可能实现一个动作的DoubleTapGesture吗?这意味着

UISwipeGestureRecognizer *swipeGesture = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGesture:)];
    swipeGesture.direction = UISwipeGestureRecognizerDirectionRight; // or whatever
    [table addGestureRecognizer:swipeGesture];
    [swipeGesture release];
    UISwipeGestureRecognizer *swipeGestureleft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeGestureleft:)];
    swipeGestureleft.direction = UISwipeGestureRecognizerDirectionLeft; // or whatever
    [table addGestureRecognizer:swipeGestureleft];
    [swipeGestureleft release];

我们可以通过这种方式向左和向右滑动,但是我想让DoubleTap手势像上面的代码一样做一个动作。提前感谢。

你可以配置UITapGestureRecognizer:

UITapGestureRecognizer *dblTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
dblTap. numberOfTapsRequired = 2;
[table addGestureRecognizer:dblTap];
[dblTap release];

最新更新