我知道在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手势像上面的代码一样执行操作。 提前致谢。
答案 0 :(得分:1)
您可以为此配置UITapGestureRecognizer:
UITapGestureRecognizer *dblTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
dblTap. numberOfTapsRequired = 2;
[table addGestureRecognizer:dblTap];
[dblTap release];