Showing a web page in your iOS app is a two step process. Maybe even a one step process if you already have a web view setup.
// 1. Setup the web view let webView: WKWebView = WKWebView() view.addSubview(webView) webView.frame = view.frame // 2. Setup the request let url = NSURL(string: "http://swiftquickstart.blogspot.com/")! let request = NSURLRequest(URL: url) webView.loadRequest(request)Recommendations:
- The webView variable should be global in your view controller
- Set the webView.frame in viewDidLayoutSubviews so when you change orientation it gets reset
(Swift 2.2)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.