这是我的WebView内容,其中底部四溢,是不可见的视图。我想通了,是web视图的父视图覆盖整个屏幕和子视图覆盖整个屏幕离开应用状态栏区域。但他们两人是有相同的尺寸,这就是为什么我的子视图向下溢出。
我读了很多的解决方案,其中大部分我试过,但没有发现差别时。
那我加载HTML文件
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, heigth=device-height, width=device-width">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta charset="utf-8">
<title>XYZ</title>
<base href=".">
<!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<root id="app-root"></root>
<script type="text/javascript" src="runtime.js"></script><script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="styles.js"></script><script type="text/javascript" src="vendor.js"></script><script type="text/javascript" src="main.js"></script></body>
</html>
WebKit的观点
static func getWebKitView(uiController : ViewController, handlerName : String) -> WKWebView {
let controller = WKUserContentController()
controller.add(uiController as! WKScriptMessageHandler, name: handlerName)
let config = WKWebViewConfiguration()
config.userContentController = controller
let webKitView = WKWebView(frame: .init(x: 0.0, y: 0.0, width: DeviceInfo().getDeviceBounds().w, height: DeviceInfo().getDeviceBounds().h-2), configuration: config)
webKitView.backgroundColor = UIColor.yellow
webKitView.scrollView.isScrollEnabled = false
// webKitView.frame.size = webKitView.scrollView.contentSize
webKitView.scrollView.contentSize = webKitView.frame.size
webKitView.allowsBackForwardNavigationGestures = true
return webKitView
}
我怎样才能解决这个问题的UI
给予高度的网页工具包查看比设备边界少100点
然后给y位置到你的孩子视图heightOfYourWebView + 10,从而按钮将是WebkitView下方和上方的屏幕的底部也给宽度为350和高度为按钮30和视图不会去出界