0

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

2 Answers 2

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];
1
  • How can I identify user tapped single or twice. Is there any delegates?
    – Codesen
    Jul 30, 2012 at 9:52
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;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.