1

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.

1

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

2 Comments

But I don't want to use any third party tool such as phonegap or sencha or any other. Thanks for your suggestion. I ll give it a try. All I understand from your answer is that I just need to load a url and capture that url in webview delegate..
I'm not suggesting that you use PhoneGap -- I just explained the idea that makes PhoneGap work. You can do the same thing in your code. If you want to send a message from the JavaScript in your web view to your Objective-C code, you do it as I described.
2

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

1 Comment

+1 Great point -- this is how you call from your Objective-C code to your JavaScript stuff.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.