Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/113.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html UIWebView如何检测<;img src="&引用/&燃气轮机;被敲打_Html_Ios_Image_Uiwebview - Fatal编程技术网

Html UIWebView如何检测<;img src="&引用/&燃气轮机;被敲打

Html UIWebView如何检测<;img src="&引用/&燃气轮机;被敲打,html,ios,image,uiwebview,Html,Ios,Image,Uiwebview,我知道下面的方法可以检测链接元素点击。但是我想知道UIView是否可以检测到img元素是否被点击 - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ switch (navigationType) { case UIWebViewNavigationTyp

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

- (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源代码如下所示:

<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>
xxxxxxxxx

xxxxxxxxx

xxxxxxxxx


你能告诉我如何使用示例代码吗?谢谢。

您的img标签没有html点击事件。如果你能让你的形象如下图所示-

<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>

您的img标记没有html单击事件。如果你能让你的形象如下图所示-

<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>
也许这个答案可以帮助你。基本上,您需要将标签包装在标签内,并在标签内处理按钮单击事件

webView:shouldStartLoadWithRequest:navigationType
方法

也许答案可以帮助你。基本上,您需要将标签包装在标签内,并在标签内处理按钮单击事件

webView:shouldStartLoadWithRequest:navigationType
方法