//在ViewController內放入UIWebView
放上IBOutlet之後 , viewDidLoad內把地址做request連結
如下:
var hotelAddr:NSString = ""
@IBOutlet weak var webView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
var address:NSString = "http://maps.google.com/maps?hl=zh-TW&q=" + (hotelAddr as String)
var url:NSURL = NSURL(string: address.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)!)!
var request:NSURLRequest=NSURLRequest(URL: url)
self.webView.loadRequest(request)
}
沒有留言:
張貼留言