singleTapGestureRecognizer

singleTapGestureRecognizer

我在UIButton中的UIView中有一堆UIScrollView。我正在尝试在滚动 View 中添加拍子识别器。点击识别器会启动,但是现在我的所有按钮都无法正常工作。

我知道在iOS5中,UIScrollView可以在完成后以某种方式将触摸事件传递给控件层次结构。有人可以帮我弄清楚该怎么做吗?

最佳答案

UIGestureRecognizer属性cancelsTouchesInView设置为NO。

UITapGestureRecognizer *singleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
                                                                                             action:@selector(singleTap:)];
singleTapGestureRecognizer.numberOfTapsRequired = 1;
singleTapGestureRecognizer.enabled = YES;
singleTapGestureRecognizer.cancelsTouchesInView = NO;
[tapableView addGestureRecognizer:singleTapGestureRecognizer];
[singleTapGestureRecognizer release];

UIGestureRecognizer Class Reference

关于用于UIScrollView的iOS5 UITapRecognizer会干扰按钮。怎么修?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8250485/

10-10 20:39