How to capture taps but pass double-taps to an underlying UIWebView?
===

I'm displaying a document in a UIWebView. I want to place a hotspot over the document to trigger an action when it is tapped, but I also want to maintain the default UIWebView behavior of auto-zooming the document when it is double-tapped. I can't figure out how to respond to the single-taps while letting the UIWebView respond to the double-taps.

I first set up the hotspot as a transparent UIButton with an action, but double-tapping the hotspot resulted in the hotspot action being called twice. So I removed the action from the button and attached a single-tap gesture instead:

	UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapAction:)];
	singleTap.numberOfTapsRequired = 1;
	singleTap.delegate = self;
	[self.hotspot addGestureRecognizer:singleTap];
	[singleTap release];

This works the same as the normal button action. Next, I created a double-tap gesture, and configured it to block the single-tap gesture with requireGestureRecognizerToFail:

	UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(zoomWebView:)];
	doubleTap.numberOfTapsRequired = 2;
	doubleTap.delegate = self;
	[self.hotspot addGestureRecognizer:doubleTap];
	[doubleTap release];

	UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapAction:)];
	singleTap.numberOfTapsRequired = 1;
	[singleTap requireGestureRecognizerToFail:doubleTap];
	singleTap.delegate = self;
	[self.hotspot addGestureRecognizer:singleTap];
	[singleTap release];

	- (void)zoomWebView:(UITapGestureRecognizer *)gesture {
		// this is called as expected -- now what?
	}

With this setup, a single-tap on the hotspot calls singleTapAction and a double-tap on the hotspot calls zoomWebView (a custom method). However, I can't figure out how to forward the double-tap event from my zoomWebView method to the UIWebView so that it performs the auto-zoom. Can I derive the UITouch and UIEvent from the gesture object passed into zoomWebView, and then send those to the UIWebView's touchesDidEnd method? Or do I need to subclass UITapGestureRecognizer, override its touchesDidEnd method, and use that to get the UITouch and UIEvent for the gesture?

Perhaps there is an easier way to do this. I feel like it should be simple for my hotspot to respond to the single-tap while ignoring the double-tap -- isn't that what the UIGestureRecognizer's delaysTouchesEnded and cancelsTouchesInView properties are for? But these options are already enabled by default. The only results I can get are to leave out requireGestureRecognizerToFail, which treats a double-tap as two single-taps, or include requireGestureRecognizerToFail, which diverts the double-tap event to my own method.

By the way, the relationship between the hotspot and the UIWebView in my view hierarchy is that of "cousins" -- they are both subviews of two sibling views. If I add the gesture recognizers to hotspot view, the web view or their "grandparent" view, I get the same result.