0

How can I identify the user touch, tap & double tap in the UIWebview. Is there any delegates available like touches begin etc?

junaidsidhu
  • 3,539
  • 1
  • 27
  • 49
Codesen
  • 7,724
  • 5
  • 29
  • 31

2 Answers2

4

here is the code to implement the single tap and double tap on webview

UITapGestureRecognizer *singleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doSingleTap)] autorelease];
singleTap.numberOfTapsRequired = 1; 
[self.myWebView addGestureRecognizer:singleTap];


UITapGestureRecognizer *doubleTap = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doDoubleTap)] autorelease];
doubleTap.numberOfTapsRequired = 2; 
[self.myWebView addGestureRecognizer:doubleTap];
junaidsidhu
  • 3,539
  • 1
  • 27
  • 49
0

The below 3 links will solve your problem

how-to-add-a-gesture-recognizer-to-a-uiwebview-subclass

iphone-custom-gestures-on-your-uiwebview

does-uigesturerecognizer-work-on-a-uiwebview

About number of taps, you can set it through the property numberOfTapsRequired

Eg:

UITapGestureRecognizer *myGusture = [[[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(doTap)] autorelease];
myGusture.numberOfTapsRequired = 1; //you can change it to any number as per your requirement.
[self.myWebView addGestureRecognizer:myGusture];
[myGusture release];
myGusture = nil;
Community
  • 1
  • 1
Shamsudheen TK
  • 30,739
  • 9
  • 69
  • 102