Iphone: UIWebview and double taps

Posted by Eyal on Stack Overflow See other posts from Stack Overflow or by Eyal
Published on 2010-03-21T15:35:37Z Indexed on 2010/03/21 15:41 UTC
Read the original article Hit count: 581

Filed under:

I would like to trap a double tap event in a UIWebView. I have derived a class from UIWebController. When I double tap it seams that the UIWebController itself is responding to my double taps instead of my class. The weird thing is that when I change the inheritance to inherit from UIView everything works just fine.

Below are snippets from my code which is supposed to invoke a pop-up when double tapped.

In the init function:

//Setup action for double tap UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)]; tap.numberOfTapsRequired = 2; [super addGestureRecognizer:tap]; [tap release];

And Also: - (void)handleDoubleTap:(UIGestureRecognizer *)gestureRecognizer { UIAlertView *someError = [[UIAlertView alloc] initWithTitle: @"Network error" message: @"Hello" delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil]; [someError show]; [someError release];

//[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICATION_FLIP_TO_PAGE_VIEW object:nil];  

}

© Stack Overflow or respective owner

Related posts about iphone