添加一个UIWebView控件,UIWebView *myWebView;
在适当的地方添加下面的代码:
//获取路线
NSMutableString *googleSearch = [NSMutableString stringWithFormat:@"http://ditu.google.cn/maps?f=d&source=s_d&saddr='北京'&daddr=31.186371,121.489885&hl=zh&t=m&dirflg=h"];[myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[googleSearch stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]]];