admin管理员组

文章数量:1289525

I want to provide my own action sheet or popover, don't want default system one.

Please notice that:

  1. I'm asking about long press not click.
  2. I need to know the URL of the link that is being long pressed.

I want to provide my own action sheet or popover, don't want default system one.

Please notice that:

  1. I'm asking about long press not click.
  2. I need to know the URL of the link that is being long pressed.
Share Improve this question edited Mar 25, 2013 at 14:27 Cezar 56.4k19 gold badges87 silver badges87 bronze badges asked Jul 29, 2012 at 14:31 an0an0 17.6k12 gold badges90 silver badges141 bronze badges 1
  • @AndreiFilip see my answer below: stackoverflow./a/15603818/1371070 – Cezar Commented Mar 25, 2013 at 14:24
Add a ment  | 

1 Answer 1

Reset to default 11

In order to provide your own action sheet or popover, first you need to disable the default contextual menu. You can do it with javascript by using the following code, inside webViewDidFinishLoad

[webView stringByEvaluatingJavaScriptFromString:@"document.body.style.webkitTouchCallout='none';"];

Once you disable the default behavior you can create your own custom action sheet/popover.

One possible approach is described in the following link:

Customize the contextual menu of UIWebView

本文标签: javascriptHow to intercept long press on links in UIWebViewStack Overflow