2015-06-11 120 views

回答

3

只显示一个UIWebView在IBAction为?你会想要这样的事情:

@IBAction func newAction(sender: UIBarButtonItem) { 

    // set up webview 
    let webView = UIWebView(frame: self.view.frame) // or pass in a CGRect frame of your choice 

    // add webView to current view 
    self.view.addSubview(webView) 
    self.view.bringSubviewToFront(webView) 

    // load the Google Maps URL 
    webView.loadRequest(NSURLRequest(URL: NSURL(string: "http://maps.google.com/maps?daddr=" + self.longitud + "," + self.latitud + "&saddr=" + self.lat1 + "," + self.long1 + "&views=traffic")!)) 
} 
+0

它不显示任何东西! –

+0

它为我工作,你确定你正在实施我的答案吗? http://i.stack.imgur.com/12VIc.png – JAL

+0

它的工作原理。谢谢 ! –