2

Imagine a UIWebView that is partly overlayed by a UIView which itself has to receive touches.

All I want to do is forward the touch events from the overlaying UIView to the UIWebView. I tried subclassing the UIView and forward the touches to UIWebView like

[webview touchesbegan:touches withEvent: event] 

but it isn't working.

Well, it works as far as I can see by subclassing the UIWebView that touchesbegan gets called. But this never happens when I touch the UIWebview directly so this is obviously not the right way to do this. Sooo, what am I doing wrong?

sebastien FCT
  • 630
  • 1
  • 13
  • 28
user3159270
  • 119
  • 2
  • 10
  • thanks for formating my text! It looks much better now. I will try it myself the next time... – user3159270 Jul 09 '14 at 09:12
  • I think you want to use gestureRecognizer on the webView, too. this (http://stackoverflow.com/questions/1049889/how-to-intercept-touches-events-on-a-mkmapview-or-uiwebview-objects?rq=1) has a few variations. – gro Jul 09 '14 at 12:23
  • I will look into it, but I don't want to capture whole screen, only the part where the overlaying UIViews are ... – user3159270 Jul 09 '14 at 13:13

1 Answers1

0

You can do this by using the javascript

NSString *javaScript = @"document.getElementById('id_username').value = 'tfusername'";

to set value on any of the data You can send click on any object by fetching its Id and then by evaluating it to send event.

NSString *myval =  [webView stringByEvaluatingJavaScriptFromString:@"document.querySelector('input[type=\"submit\"][value=\"Log in\"]').click();"];

May be this is what you are asking for. Thanks

Esha
  • 1,328
  • 13
  • 34