Just wondering if there is a way to send keyevents or text to a webview.
I have an app which the user can click a button to perform a specific tasks. Depeneding on the button the user has clicked the textbox inside the webview needs to be populated.
I can handle the button click event and all that but just wanted to find out if I can pass that text to the webview.
I have searched on google but havent found any solutions yet. maybe I am missing something.
Anyway thanks in advance.
HTML Side:
Assume following is the javascript method which fires upon calling it in your Objective-C method..ie.,native side.
Native Side:
Create UIWebview to load the above html (well i am doing it in local now).
Now add the gesture delegate to the whole webview.
//handleTapGesture is a native method,in the sense "On detecting if its a native touch,what you want perform?"
Now we are all set.Next step is to implement the delegate called
On detecting the touch event on the webview,the implemented delegate function gets called.
If you add the above code just like that,on tapping the webview the above delegate gets called N number of times(sometimes 8,9,13 etc).Only solution is we should be able to know the state of the touch(whether its end or start),to reset the touch event for the next call.
If the
javastr
returns any value(text),it's a HTML touch or else its a native touch,"handleTapGesture" gets called.For more detailed information check out my blog==> Feel the difference between HTML touch and Native touch on UIWebView
Hope this helps you.happy coding...