我试图在uiwebview中检测双击。以下是代码。当我调试时,调试器来到initwithcoder,但从来没有touchesbegan也没有选择器功能。为什么这样 ?在UIWebView中检测双击
我把一个UIWebView在我的厦门国际银行文件和设置身份检查类MyWebView
#import "MyWebView.h"
@implementation MyWebView
- (void) initTap {
UITapGestureRecognizer *singleFingerDoubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleFingerDoubleTap:)];
singleFingerDoubleTap.numberOfTouchesRequired = 1;
singleFingerDoubleTap.numberOfTapsRequired = 2;
[self addGestureRecognizer:singleFingerDoubleTap];
[singleFingerDoubleTap release];
}
- (id)initWithCoder:(NSCoder*)coder
{
if (self = [super initWithCoder:coder]) {
// Initialization code.
[self initTap];
}
return self;
}
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
[self initTap];
}
return self;
}
-(void)handleSingleFingerDoubleTap:(id)sender {
NSLog(@"Doulble click detected !");
}
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
if (touch.tapCount == 2) {
//put you zooming action here
NSLog(@"Doulble click detected !");
}
}
- (void)dealloc {
[super dealloc];
}
@end
链接是死 – onmyway133
@ onmyway133 - 感谢您的通知作为后太旧,那么可能引用链接可能已经删除。 –
如果任何负面评价者分享了一个有效的URL来帮助其他股东,我们将不胜感激。 –