[ios] swift 체험하기 #10 웹뷰
1. 새 프로젝트를 만든다.
2. 뷰 컨트롤러에 웹뷰를 넣고 사이즈를 맞춘다.
3. ViewController.swift
import UIKit
import WebKit
class ViewController: UIViewController, WKUIDelegate, WKNavigationDelegate {
@IBOutlet weak var webView: WKWebView!
override func loadView() {
super.loadView()
webView = WKWebView(frame: self.view.frame)
webView.uiDelegate = self
webView.navigationDelegate = self
self.view = self.webView
}
override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "http://winddevillord.tistory.com")
let request = URLRequest(url: url!)
webView.load(request)
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
}
'메뉴 일곱' 카테고리의 다른 글
[ios] swift 체험하기 #11 알림 (0) | 2019.04.18 |
---|---|
[ios] swift 체험하기 #9 딕셔너리 (0) | 2019.04.15 |
[ios] swift 체험하기 #8 배열 (0) | 2019.04.12 |