How do I add a UIWebView to my iOS app?

前端 未结 3 1177
旧时难觅i
旧时难觅i 2021-02-05 13:03

I have an app at the moment that when a button is pushed on the first screen does some work and makes a URL, and then does

[[UIApplication sharedApplication] op         


        
3条回答
  •  心在旅途
    2021-02-05 13:58

    For adding UIWebView using Swift to your app just drag the WebView to your story board and then using an assistant editor connect WebView to ViewController.swift And then Loading URL to WebView is very easy. Just create a WebView in your storyboard and then you can use the following code to load url.

        let url = NSURL (string: "https://www.simplifiedios.net");
        let request = NSURLRequest(URL: url!);
        webView.loadRequest(request);
    

    As simple as that only 3 lines of codes :)

    Ref: UIWebView Example

提交回复
热议问题