Hi,
I have created a simple WKView with a local webpage which is loaded.
I have a problem with display of the html document : I would like to constrain the view of the page to the Safe Area, and not to Super View. At this moment, when I scroll down, html page is visible at the top of the screen, in the status bar, which is not very beautiful on last iPhones (mix of text of my page and device hours/network status/battery status...).
I tested multiple solutions, in info file, but I am unable to suppress the transparency of this status bar or constrain webpage to fit only in Safe Area.
Could you help me ?
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate {
var webView: WKWebView!
override func loadView() {
let webConfiguration = WKWebViewConfiguration()
webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.uiDelegate = self
view = webView
}
override func viewDidLoad() {
super.viewDidLoad()
if let indexURL = Bundle.main.url(forResource: "index",
withExtension: "html",
subdirectory: "files") {
self.webView.loadFileURL(indexURL,
allowingReadAccessTo: indexURL)
}
}}