如何删除两个手势识别器之间的依赖关系?

时间:2017-03-31 13:06:56

标签: ios objective-c uigesturerecognizer

我使用下面的代码测试WKWebView中长按问题的解决方案。

我知道如何在两个手势识别器之间创建依赖关系但是如何删除它呢?

if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {

    // Break

    [gestureRecognizer requireGestureRecognizerToFail:otherGestureRecognizer];
}
else {

    // Fix

    // ...
}

假设有类似的东西:

[gestureRecognizer shouldntRequireGestureRecognizerToFail:otherGestureRecognizer];

[gestureRecognizer removeDependencies];

1 个答案:

答案 0 :(得分:1)

应该是这样的

<!doctype html>
  <html>
    <head>
      <title>Testing socket.io</title>
      </head>
    <body>
      <input type="button" id="button" style="width: 100px; padding: 10px; box-shaddow: 10px 6px 5px; #999999; -webkit-box-shadow: 6px 6px 5px #999999; -moz-box-shadow: 6px 6px 5px #999999; font-weight: bold; background: #16ed07; color: #000000; cursor: pointer; border-radius: 10px; border: 1px solid #D9D9D9; font-size: 150%;" value="Send!" onClick="onClickHandler(this)"/>
      <h2 id="alert"> waiting...</h2>


      <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js"></script>
      <script>
        var socket = io("http://localhost:3000");
        socket.on('connect', function() {
          document.getElementById("button").addEventListener("click", function () {
              socket.emit("clicked");
          });

         });
        socket.on('clicked', function() {
          console.log('clicked');
          document.getElementById("alert").innerHTML = "send clicked";
        });




      </script>

       <script type="text/javascript">
function onClickHandler(elem) {
elem.style.background = 'red';
elem.style.color = 'black';
}
</script>

    </body>
  </html>