大佬教程收集整理的这篇文章主要介绍了iphone – UIWebview中的谷歌地图直接显示行车路线而不是地图,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
UIWebView *webView=[[UIWebView alloc]initWithFrame:webViewRect]; webView.delegate=self; webView.scalesPageToFit=YES; CLLOCATIOnCoordinate2D start = { 34.052222,-118.243611 }; CLLOCATIOnCoordinate2D desTination = { 37.322778,-122.031944 }; //NSString *urlString=@"http://maps.google.co.in/"; NSString *googleMapsURLString = [NSString StringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&daddr=%1.6f,%1.6f",start.latitude,start.longitude,desTination.latitude,desTination.longitude]; NSLog(@"URL String-----> %@",googleMapsURLString); NSURL *url=[NSURL URLWithString:googleMapsURLString]; NSURLrequest *requestObj=[NSURLrequest requestWithURL:url]; [webView loadrequest:requestObj]; [self.view addSubview:webView];
NSString *googleMapsURLString = [NSString StringWithFormat:@"http://maps.google.com/?saddr=%1.6f,desTination.longitude];
使用以下代码
NSString *googleMapsURLString = [NSString StringWithFormat:@"http://maps.google.com/?saddr=%1.6f,%1.6f&output=embed",desTination.longitude];
唯一添加的是output = embed,它强制Web直接打开地图而不打开屏幕,该屏幕要求输入源和目标的填充框.
有关更多说明,您还可以查看Google Map Parameters中谷歌地图中使用的所有参数
以上是大佬教程为你收集整理的iphone – UIWebview中的谷歌地图直接显示行车路线而不是地图全部内容,希望文章能够帮你解决iphone – UIWebview中的谷歌地图直接显示行车路线而不是地图所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。