LoginSignup
6
5

More than 5 years have passed since last update.

SwiftでのUIWebViewサンプル

Last updated at Posted at 2014-12-20

環境:Xcode 6.1.1
webViewのアウトレットはAssistant Editorで生成

class ViewController: UIViewController, UIWebViewDelegate {
    @IBOutlet weak var webView: UIWebView!

    override func viewDidLoad() {
        super.viewDidLoad()
        webView.delegate = self

        var url = NSURL(string: "http://google.com")
        var urlRequest = NSURLRequest(URL: url!)
        webView.loadRequest(urlRequest)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }

    func webViewDidFinishLoad(webView: UIWebView) {
        NSLog("web loaded")
    }
}

参考
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIWebView_Class/index.html

6
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
5