0
我一直在嘗試用Swift學習iOS開發,但我一直試圖加載一個簡單的網頁一個星期左右。我已經看了四周,下面的代碼似乎適用於其他人,但是當我運行iOS模擬器時,什麼也沒有顯示,但是UIWebView
的背景。UIWebView不加載網頁
class ViewController: UIViewController {
@IBOutlet weak var myWebView: UIWebView!
let myURL = NSURL(fileURLWithPath: "https://www.google.com")
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
myWebView.loadRequest(NSURLRequest(URL: myURL!))
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}