views:

524

answers:

0

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];  
}