터치가 webview 외부에서 끝나면 "onTouchEnd"는 실행되지 않습니다. 컴파일은 엑스 코드 6, iOS 용 8, 아이폰 6IOS - 전체 화면이 아닌 webview에 대한 "touchend"이벤트 없음
와 나는 다음의 레이아웃을 가지고 : 나는 웹보기의 모든 터치 이벤트, 터치 시작 및 종료를받을 수 있습니다
|Navigation TAB|
|Left view|Web view|Right view|
|page view|
. 그러나 웹 뷰에서 터치를 시작한 다음 터치를 외부로 이동하면 webview 테두리를 떠나 자마자 touchmove 이벤트 수신을 중단하고 touchend 이벤트가 수신되지 않습니다.
코드 FOT 테스트 HTML 파일 :이 해결 될 수있는 방법 "의 viewDidLoad"기능
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.webView = [[UIWebView alloc] initWithFrame:self.mainView.bounds];
[self.webView setScalesPageToFit:YES];
[self.webView setAlpha:1];
/* Disable scrolling of web view */
for (id subview in [self.webView subviews]) {
if ([subview isKindOfClass:[UIScrollView class]]) {
((UIScrollView*)subview).bounces = NO;
}
}
self.webView.scrollView.bounces = NO;
self.webView.scrollView.canCancelContentTouches = NO;
self.webView.scrollView.scrollEnabled = NO;
self.webView.backgroundColor = [UIColor magentaColor]; //[UIColor colorWithRed:(45.0/255.0) green:(50.0/255.0) blue:(53.0/255.0) alpha:1];
self.webView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin| UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
[self.mainView addSubview:self.webView];
NSString * localHtmlFilePath = [[NSBundle mainBundle] pathForResource:@"main" ofType:@"html" inDirectory:@"www"];
NSString *html = [NSString stringWithContentsOfFile:localHtmlFilePath encoding:NSUTF8StringEncoding error:nil];
[self.webView loadHTMLString:html baseURL:nil];
의
<head>
</head>
<body bgcolor="#CC6"
ontouchmove="console.info('move');"
ontouchstart="console.info('start');"
ontouchend="console.info('end');"
ontouchcancelled="console.info('canceled');"
>
<h1>This is a test</h1>
<p> Lore ip sum </p>
</body>
코드? 내가 놓친 구성이 있습니까?
완전한 소스 코드는 여기에서 찾을 수 있습니다 : https://github.com/Daraku/WebViewBug
에서는 setTimeout이 - 해킹, 내가 최종 무슨 일이 (내가 훨씬 작은 시간 값을 사용하지만)를 사용합니다. 보이는 것처럼, 적절한 해결책이 없습니다 : ( –