从图像中可以看到,我想从代码中禁用安全区域布局指南“红色区域”,因为从代码中构建我的UI不会使故事变得无聊,因此我的视图可以覆盖整个屏幕
let webConfiguration = WKWebViewConfiguration()
webConfiguration.userContentController.add(self, name: "webpage")
self.webpage = WKWebView(frame: .zero, configuration: webConfiguration)
self.webpage.navigationDelegate = self
self.webpage.uiDelegate = self
self.webpage.isOpaque = false
self.webpage.scrollView.isScrollEnabled = false
self.webpage.backgroundColor = UIColor.clear
self.webpage.scrollView.backgroundColor = UIColor.clear
view = webpage
答案 0 :(得分:0)
您可以像这样覆盖属性-
override var safeAreaLayoutGuide: UILayoutGuide {
return UILayoutGuide()
}