【问题标题】:Is there any way to find gesture recognizer in UIWebView有没有办法在 UIWebView 中找到手势识别器
【发布时间】:2011-12-26 09:28:50
【问题描述】:

我正在尝试电子书阅读应用程序。我想通过单击索引页面链接来创建 UIActionSheet。为此,我如何识别 webView 中的触摸事件,因为 WebView 已经具有内置的 longTouch 事件。有什么方法可以识别 webView 中的 longtouch 事件吗?

【问题讨论】:

    标签: iphone xcode uiwebview


    【解决方案1】:

    只需覆盖下面的方法来处理我们的手势

      - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer
            *)otherGestureRecognizer
       {
            return YES;
       }
    
            For adding longPress add to your view
    
    
    
    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
    longPress.minimumPressDuration=0.8;
    longPress.delegate = self;
    [self addGestureRecognizer:longPress];
    [longPress release];
    
    - (void)longPress:(UILongPressGestureRecognizer*)gesture 
    {
    }
    

    【讨论】:

    • 我试过了,但它没有进入 longPress: 方法..它显示了内置的弹出窗口。
    • 我忘记将委托添加到 longPress 然后它会调用
    • 你能告诉我如何在 webview 中隐藏内置弹出窗口吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多