Answer the question
In order to leave comments, you need to log in
Swift WebView and white screen in simulator, what's wrong?
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var webview: UIWebView!
func loadAddressUrl(){
if let url = NSURL(string: "http://google.com/"){
let request = NSURLRequest(URL: url)
webview?.scalesPageToFit = true
webview?.loadRequest(request)
}
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
loadAddressUrl()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question