我有一个UIWebView
用来显示HTML
内容的阅读器,类似于 kobo 和iBooks
.
我现在正在过渡到WKWebView
它似乎已UIWebView
被弃用。
我面临的问题是WKWebView
根本无法识别长触摸手势并且没有显示任何选择。虽然这个问题没有显示使用UIWebView
.
这就是我实施的方式WKWebView
:
WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
theConfiguration.selectionGranularity = WKSelectionGranularityCharacter;
readWKWebView = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];
readWKWebView.contentMode = UIViewContentModeScaleAspectFit;
readWKWebView.scrollView.scrollEnabled = true;
readWKWebView.multipleTouchEnabled = true;
[self.view addSubview:readWKWebView];
readWKWebView.userInteractionEnabled = true;
readWKWebView.contentMode = UIViewContentModeScaleAspectFit;
[readWKWebView loadFileURL:htmlPathURL allowingReadAccessToURL:[NSURL fileURLWithPath:stringOfAllwedPath]];
[readWKWebView loadHTMLString:loadString baseURL:baseURL];
我确实在其中注入了以下css HTML
:
html {
height:730px;
font-size:24px;
width:100%;
}
body {
margin:0px;
padding:0px;
width:100%;
}
#viewer {
width:668px;
height:730px;
}
#book {
width:668px;
height:730px;
margin-left:50px;
margin-right:50px;
-webkit-column-count:auto;
-webkit-column-width:668px;
-webkit-column-gap:100px;
text-align:right;
}
.h {
margin-top:220px;
}
知道没有选择功能背后的原因是什么吗?