gpt4 book ai didi

iphone - 点击手势识别器不适用于 UIView 内部的 UIScrollView 中的 UIWebiew

转载 作者:可可西里 更新时间:2023-11-01 05:38:17 24 4
gpt4 key购买 nike

我已将 WebView 放置在 Scrollview 中,而 Scrollview 又放置在 viewcontroller 的 View 中。在 webview 上点击时,不会调用“tapRecognized”方法。

这是我的代码:

    UITapGestureRecognizer *oneFingerTwoTaps = 
[[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapRecognized)] autorelease];

[oneFingerTwoTaps setNumberOfTapsRequired:1];


// Add the gesture to the view

[[self view] addGestureRecognizer:oneFingerTwoTaps];

我也试过 foll :

[scrollview addGestureRecognizer:oneFingerTwoTaps];

[webview addGestureRecognizer:oneFingerTwoTaps];

请帮忙

最佳答案

尝试添加以下语句:

//.h
...
@interface yourclass <UIGestureRecognizerDelegate>
...

//.m
...
[oneFingerTwoTaps setDelegate:self];
...

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

希望对你有帮助

关于iphone - 点击手势识别器不适用于 UIView 内部的 UIScrollView 中的 UIWebiew,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10162029/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com