Does UIGestureRecognizer work on a UIWebView?

Posted by rscott on Stack Overflow See other posts from Stack Overflow or by rscott
Published on 2010-05-26T02:35:30Z Indexed on 2010/05/26 2:41 UTC
Read the original article Hit count: 726

I am attempting to get a UIGestureRecognizer working with a UIWebview which is a subview of a UIScrollView. This sounds odd but when I have the numberOfTouchesRequired set to 2 the selector fires, but when numberOfTouchesRequired is set to one the selector doesn't fire.

Here is my code:

UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(select1:)];
    tap1.numberOfTouchesRequired = 2;
    tap1.numberOfTapsRequired = 1;
    tap1.delegate = self;
    [self.ans1WebView addGestureRecognizer:tap1];
    [tap1 release];

- (void) select1:(UILongPressGestureRecognizer *)sender {
    //Do Stuff
}

I've confirmed this by using the Apple sample for UIGestureRecognizer and inserting a webview in their nib. Their tap code works everywhere but inside the area of the webview.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c