【发布时间】:2015-08-21 21:00:34
【问题描述】:
我一直在尝试使用 Swift 学习 iOS 开发,但我在尝试加载一个简单的网页一周左右的时间里一直被困住。我环顾四周,以下代码似乎对其他人有用,但是当我运行 iOS 模拟器时,除了 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.
}
}
【问题讨论】:
标签: ios iphone swift uiwebview