2010-08-12 61 views
1

我注意到应用程序“Reeder”正在使用UIWebView但忽略此事件。 它显示自定义视图,而不是原始UIActionSheet视图。我如何忽略在UIWebView中按住链接一秒的actionSheet的动作

+0

会非常有兴趣找出来,我自己。我知道的唯一方法会违反App Store规则。 – Jasarien 2010-08-12 08:38:46

+0

这里是一个处理类似的事情的大写文章:http://stackoverflow.com/questions/1258771/uiwebview-events-and-hold-to-select-copy – xhan 2010-08-12 08:42:41

+0

本教程有帮助吗? (从您链接的问题)http://mithin.in/2009/08/26/detecting-taps-and-events-on-uiwebview-the-right-way/ – Jasarien 2010-08-12 09:19:50

回答

0

找到了解决自己:

避免使用任何html tag <a></a>,而不是使用JavaScript onClick处理单击事件。

这里有一个例子:


<script type="text/javascript"> 
window.plaction = function(url) { 
    window.location.href = url; 
    // window.location = url; 
}; 
</script> 

<p> onclick="plaction('title:a::url:http://localhost:3000/toplists/2.xml')" class="name">contents<p> 

+0

所以这只适用于你从你的应用程序加载的HTML中使用onClick事件编写的html代码,对吗?没有使用一些hacky JavaScript重写,你不能在正常的网页上使用这个解决方案。 – Jasarien 2010-08-18 12:07:01

+0

对,大多数时候它应该适用于你自己的应用程序和自己的网页。但对于一些像rss阅读器的应用程序,必须有其他方法来解决它。 – xhan 2010-08-19 09:30:42