<small id='VvFuR'></small><noframes id='VvFuR'>

      <i id='VvFuR'><tr id='VvFuR'><dt id='VvFuR'><q id='VvFuR'><span id='VvFuR'><b id='VvFuR'><form id='VvFuR'><ins id='VvFuR'></ins><ul id='VvFuR'></ul><sub id='VvFuR'></sub></form><legend id='VvFuR'></legend><bdo id='VvFuR'><pre id='VvFuR'><center id='VvFuR'></center></pre></bdo></b><th id='VvFuR'></th></span></q></dt></tr></i><div id='VvFuR'><tfoot id='VvFuR'></tfoot><dl id='VvFuR'><fieldset id='VvFuR'></fieldset></dl></div>
    1. <legend id='VvFuR'><style id='VvFuR'><dir id='VvFuR'><q id='VvFuR'></q></dir></style></legend>

        <tfoot id='VvFuR'></tfoot>
          <bdo id='VvFuR'></bdo><ul id='VvFuR'></ul>

        UIWebView 如何检测 &lt;img src=&quot;...&quot;/&

        时间:2023-11-09
        <i id='gJb16'><tr id='gJb16'><dt id='gJb16'><q id='gJb16'><span id='gJb16'><b id='gJb16'><form id='gJb16'><ins id='gJb16'></ins><ul id='gJb16'></ul><sub id='gJb16'></sub></form><legend id='gJb16'></legend><bdo id='gJb16'><pre id='gJb16'><center id='gJb16'></center></pre></bdo></b><th id='gJb16'></th></span></q></dt></tr></i><div id='gJb16'><tfoot id='gJb16'></tfoot><dl id='gJb16'><fieldset id='gJb16'></fieldset></dl></div>

            <legend id='gJb16'><style id='gJb16'><dir id='gJb16'><q id='gJb16'></q></dir></style></legend>

                <bdo id='gJb16'></bdo><ul id='gJb16'></ul>
                  <tbody id='gJb16'></tbody>
                <tfoot id='gJb16'></tfoot>

                <small id='gJb16'></small><noframes id='gJb16'>

                • 本文介绍了UIWebView 如何检测 &lt;img src=&quot;...&quot;/&gt;被窃听的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我知道下面的方法可以检测链接元素点击.但是我想知道 UIView 是否可以检测到 img 元素是否被点击?

                  I know that method below can detect a link element tap. But I want to know if the UIView can detect if the img element is tapped?

                  - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
                  switch (navigationType) {
                      case UIWebViewNavigationTypeLinkClicked:
                          NSLog(@"link is click");
                          //do something
                          break;
                      default:
                          break;
                     }
                  
                      return true;
                  }
                  

                  一些html源代码如下:

                  Some html source like below:

                  <p>xxxxxxxxx</p>
                  <p><img src="http://imgs.ebrun.com/resources/2015_06/2015_06_16/201506167911434413787546.jpg"> </p>
                  <p>xxxxxxxxx。</p>
                  <p><img src="http://imgs.ebrun.com/resources/2015_06/2015_06_16/201506167911434413787546.jpg"> </p>
                  <p>xxxxxxxxx。</p>
                  

                  你能告诉我如何使用示例代码来做到这一点吗?谢谢.

                  Could you show me how to do it using sample code? Thanks.

                  推荐答案

                  你的img标签没有html点击事件.如果你可以像下面这样制作你的图像 -

                  Your img tag does not have html click event. If you can make your image like below way -

                  <p>xxxxxxxxx</p>
                  <p><img src="http://imgs.ebrun.com/resources/2015_06/2015_06_16/201506167911434413787546.jpg" onclick="myfunction()"> </p>
                  <p>xxxxxxxxx。</p>
                  <p><img src="http://imgs.ebrun.com/resources/2015_06/2015_06_16/201506167911434413787546.jpg" onclick="myfunction()"> </p>
                  <p>xxxxxxxxx。</p>
                  

                  然后您可以在 UIWebView 委托方法中捕获您的 img 点击事件 - shouldStartLoadWithRequest.

                  Then you can catch your img click event within UIWebView Delegate method - shouldStartLoadWithRequest.

                  其他可能的选项 -

                  否则,您已经编写了一个 javascript 方法,该方法将 OnClick 方法动态添加到所有 IMG 标记.并在您的页面加载到 UIWebView 时调用此 javascript 方法 -

                  Otherwise you have write a javascript method which dynamically add OnClick method to all IMG tags. And call this javascript method when your page load in UIWebView -

                  - (void) webViewDidFinishLoad:(UIWebView *)webView
                  {
                      //Execute javascript method or pure javascript if needed
                      [_webView stringByEvaluatingJavaScriptFromString:@"methodName();"];
                  }
                  

                  这篇关于UIWebView 如何检测 &lt;img src=&quot;...&quot;/&gt;被窃听的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 iphone webView 中打开 .docx 的代码 下一篇:将图像下载到捆绑包中?

                  相关文章

                  <small id='ncXgr'></small><noframes id='ncXgr'>

                    <bdo id='ncXgr'></bdo><ul id='ncXgr'></ul>
                • <i id='ncXgr'><tr id='ncXgr'><dt id='ncXgr'><q id='ncXgr'><span id='ncXgr'><b id='ncXgr'><form id='ncXgr'><ins id='ncXgr'></ins><ul id='ncXgr'></ul><sub id='ncXgr'></sub></form><legend id='ncXgr'></legend><bdo id='ncXgr'><pre id='ncXgr'><center id='ncXgr'></center></pre></bdo></b><th id='ncXgr'></th></span></q></dt></tr></i><div id='ncXgr'><tfoot id='ncXgr'></tfoot><dl id='ncXgr'><fieldset id='ncXgr'></fieldset></dl></div>
                • <tfoot id='ncXgr'></tfoot>
                  <legend id='ncXgr'><style id='ncXgr'><dir id='ncXgr'><q id='ncXgr'></q></dir></style></legend>