0

I am trying to programmatically make a 2nd tap occur on the screen a few seconds after the actual tap event occurs. For example, if I tap the screen in the bottom left corner...is it possible to then programatically make a tap occur at a specified set of coordinates a few seconds later (see image). enter image description here

Cybernetic
  • 12,628
  • 16
  • 93
  • 132
  • 1
    I don't know if there's a way to make a tap programmatically, however, there's most likely a way to programmatically run the sequence of events that would occur if a tap had been there. What is it you would like to have happen? – Logan Apr 12 '14 at 17:38
  • +1 for Logan; programmatically faking a tap isn't a very good way to be going about things. Give some more context on what you're trying to achieve (preferably posting your code so far). – davidf2281 Apr 12 '14 at 17:40
  • I am displaying a website with 6 images that fits into the screen of a UIWebView. To see a different set of 6 images the user normally taps on one of the category links at the top of the webpage. But I want the category filtering to change when someone taps any image...not the link at the top. I need the user to tap the image (there will be an invisible button over each image) and then for a simulated tap to occur at the known location of the link at the top that changes the image category. The reason I'm not doing JQuery on the site itself is that I need the App to register the image tap. – Cybernetic Apr 12 '14 at 17:45
  • Possible duplicate: http://stackoverflow.com/questions/4137205/simulate-touch-on-iphone – Logan Apr 12 '14 at 17:55

1 Answers1

0

You don't need to do horrid things like overlaying invisible buttons and faking taps.

All you need to do is set your view controller to conform to the UIWebViewDelegate protocol, and implement the webView:shouldStartLoadWithRequest:navigationType: protocol method.

By implementing this method and checking for a link-tap event with if(navigationType == UIWebViewNavigationTypeLinkClicked) your app is now being informed of link-taps without intercepting and eating them via invisible buttons, so your web site doesn't miss out on being informed of the request.

You can then implement the necessary logic to change categories in JQuery on the site.

davidf2281
  • 1,319
  • 12
  • 20