lundi 12 août 2019

How I can do everything right in webview?

I need to show the website page on my phone screen by pushing my finger to display

Just do it for me, it is so easy, questions inside the code

I wrote some code, stole something from GitHub, it seems working, but in result I had a totally black screen

Recently, folder with project was uploaded on GitHub https://github.com/dphd1x/swift

    //Kind of crazy stuff
override func loadView() {
    webView = WKWebView()
    webView.navigationDelegate = self
    view = webView
}

override func viewDidLoad() {
    super.viewDidLoad()

    //General view with page, followed by link
    let url = URL(string: "https://google.com")! //example
    webView.load(URLRequest(url: url))

    //Refresh button on the bottom of the view
    let refresh = UIBarButtonItem(barButtonSystemItem: .refresh, target: webView, action: #selector(webView.reload))
    toolbarItems = [refresh]
    navigationController?.isToolbarHidden = false
}
    //I do not sure, is that ui?
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
    title = webView.title
}

unexpected result




Aucun commentaire:

Enregistrer un commentaire