Created
February 24, 2016 07:04
-
-
Save sigwyg/567521f321debf224a22 to your computer and use it in GitHub Desktop.
SwiftでWeb Viewを使用するサンプル。Web Viewの読み込み前に実行されてクラッシュすることもあるらしいので、存在チェックはしておく。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBOutlet weak var webView: UIWebView! | |
func configureView() { | |
let path = "http://example.com/" | |
if let postWebview = self.webView { | |
let requestURL = NSURL(string: path) | |
postWebview.loadRequest(NSURLRequest(URL: requestURL!)) | |
//let HTMLString:String! = "<h1>Hello Swift!</h1>" | |
//postWebview.loadHTMLString(HTMLString, baseURL: nil) | |
} | |
} | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
self.configureView() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment