2015-06-11 88 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

它的工作原理。謝謝 ! –