Reputation: 1504
I want to show a popover view on top of a webview. And the popover should be shown on selecting any UI element in webview. I am able to capture the touch event in a Javascript code . Can anyone help me.. Is it possible to post a notification event from the Javascript..? Is there any other way of achieving this..? Thanks.
Upvotes: 1
Views: 158
Reputation: 1140
You can easily call your scripts (with in the sandbox) from your objective-c methods. Thw Web kit has the methods for evaluating Script codes
[webview stringByEvaluatingJavaScriptFromString:@"myJavascriptFunction()"];
Check this tutorials to learn dig deeper Tutorial-1 and Tutorial-2.. hope this helps you...
Upvotes: 2
Reputation: 125037
This is exactly what PhoneGap does. The idea behind it is that in response to the touch, your JavaScript loads a particular URL, possibly with a custom scheme. The web view delegate's -webView:shouldStartLoadWithRequest:navigationType:
method is called before the web view actually makes the request. If the implementation of that method recognizes the URL, it can then take whatever action it likes, such as displaying a popover view.
Upvotes: 2