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.
}
}