如何在 UIWebview 中识别用户touch
和tap
& 。double tap
是否有任何可用的代表,例如触摸开始等?
问问题
1507 次
2 回答
4
这是在 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];
于 2012-07-30T09:46:14.493 回答
0
以下3个链接将解决您的问题
iphone-custom-gestures-on-your-uiwebview
uigesturerecognizer-work-on-a-uiwebview
关于点击次数,可以通过属性numberOfTapsRequired设置
例如:
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;
于 2012-07-30T10:03:15.377 回答