我在UIWebView
添加了长按手势。但我希望UIWebView
能够在识别出我的长按之前处理标准的Tap事件。 (两个手势应该在Long Tap上处理 - 一个简单的Tap和我的Long Tap)。怎么做?
我认为需要在UIWebView
上将Tap事件发送到TouchBegin
。这是对的吗?
答案 0 :(得分:2)
正确的代码:
- (void)viewDidLoad {
UILongPressGestureRecognizer* gesture = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)] autorelease];
gesture.delegate = self;
[myWebView addGestureRecognizer:gesture];
}
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
return YES;
}
答案 1 :(得分:1)
请参阅本节UIGestureRecognizerDelegate
你发现当2个手势同时工作时会调用它。
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer: