Я хотел бы перехватить событие двойного нажатия в UIWebView. Я получил класс от UIWebController. Когда я дважды нажимаю, это показывает, что сам UIWebController реагирует на мои двойные нажатия вместо моего класса. Странно то, что когда я меняю наследование на UIView, все работает просто отлично.
Ниже приведены фрагменты из моего кода, которые должны вызывать всплывающее окно при двойном нажатии.
В функции init:
//Setup action for double tap
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTap:)];
tap.numberOfTapsRequired = 2;
[super addGestureRecognizer:tap];
[tap release];
А также:
- (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];
}