小编Kam*_*ani的帖子

UIWebview中的Google地图直接显示行车路线而非地图

我加载在UIWebView的谷歌地图提供的经纬度长坐标源和destination.But的问题是,它显示行车路线时,得到loaded.If我们想看到的地图,然后我们要在地图上点击按钮提供在地址旁边.我需要在加载Web视图时直接显示地图而不是行车路线.任何人都可以告诉我如何实现这一目标.

 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];
Run Code Online (Sandbox Code Playgroud)

另外我想知道如果我需要从说到位置A到B和从B到C,我如何传递URL.

iphone ipad

4
推荐指数
1
解决办法
4450
查看次数

标签 统计

ipad ×1

iphone ×1