【发布时间】:2018-07-11 05:58:43
【问题描述】:
我正在尝试在我的应用程序中添加 webView。
在低版本的iOS中,webView在状态栏的后面。在iOS 11及更高版本中,webView定位正确。为什么在低版本的iOS中定位不正确? 如何在支持所有 iOS 设备的 webView 和状态栏之间添加空间?
这是我的代码
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
我尝试添加边距和顶部约束。它不起作用。
let margins = view.layoutMarginsGuide
webView.topAnchor.constraint(equalTo: margins.bottomAnchor,constant : 200).isActive = true
view.layoutMargins = UIEdgeInsets(top: 164, left: 0, bottom: 0, right: 0)
希望你能理解我的问题。 提前致谢。
【问题讨论】:
标签: ios swift statusbar margins