Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html WKWebView对长时间单击没有响应_Html_Objective C_Select_Wkwebview_Long Click - Fatal编程技术网

Html WKWebView对长时间单击没有响应

Html WKWebView对长时间单击没有响应,html,objective-c,select,wkwebview,long-click,Html,Objective C,Select,Wkwebview,Long Click,我有一个阅读器,在上面我使用UIWebView显示HTML内容,类似于kobo和iBooks 我现在正在过渡到WKWebView,因为UIWebView似乎已被弃用 我面临的问题是,WKWebView根本无法识别长触摸手势,并且没有显示任何选择。而使用UIWebView时未显示此问题 这就是我如何实现的WKWebView: WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init]; theCo

我有一个阅读器,在上面我使用
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];
我确实在
HTML
中插入了以下css:

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;
}

你知道缺少选择功能的原因是什么吗?

事实上,问题不在于选择本身,而在于WKWebView与UIWebView不同,它上面有一个图层时,不会响应手势。因此,在把它带到前线之后,问题就解决了

WKWebViewConfiguration *theConfiguration = [[WKWebViewConfiguration alloc] init];
theConfiguration.selectionGranularity = WKSelectionGranularityCharacter;

WKWebView *myWkWebview = [[WKWebView alloc] initWithFrame:self.view.frame configuration:theConfiguration];
[self.view addSubview: myWkWebview];
[self.view bringSubviewToFront:myWkWebview];

你想用长按来做什么?电子邮件?还是链接?你也可以附加你的HTML页面进行选择,我需要从网络视图中选择文本,以允许突出显示和其他功能