-
Notifications
You must be signed in to change notification settings - Fork 0
WebView
Mohammad Azmal Hossain edited this page Mar 22, 2017
·
1 revision
// in Info.plist add "App Transport Security Settings" and in "App Transport Security Settings" add "Allow Arbitrary Loads" import UIKit
class ViewController: UIViewController {
let webView = UIWebView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = .green
webViewSetup()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func webViewSetup() {
webView.frame = CGRect(x: 0, y: 0, width: view.frame.size.width, height: view.frame.size.height)
// let url = NSURL(string: "http://azmalonline.blogspot.com/")
let myUrl = NSURL(string: "https://www.facebook.com/photo.php?fbid=181200285605224&set=picfp.100011457625345.171495266575726&type=3&theater")
let myRequest = NSURLRequest(url: myUrl as! URL)
webView.scalesPageToFit = true
webView.loadRequest(myRequest as URLRequest)
view.addSubview(webView)
}
}