UIWebView *webview = [[UIWebView alloc]init];
webview.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
//唤起百度地图APP 方式一
NSString *strOrigin = @"34.2043700000,109.0071120000";
NSString *strDestination = @"34.2069970000,108.9362530000";
NSString *urlFirst =[NSString stringWithFormat:@"baidumap://map/direction?origin=%@&destination=%@&mode=driving&src=webapp.navi.yourCompanyName.yourAppName",strOrigin,strDestination];
//加载页面 显示地图页面,再主动点击唤起百度地图APP 方式二
NSString *originFrom = @"34.1986380000,108.8931260000";
NSString *urlSecon = [[NSString stringWithFormat:@"http://api.map.baidu.com/direction?origin=latlng:%@|name:我的位置&destination=大雁塔&mode=driving®ion=西安市&output=html",originFrom] stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
// NSURL *url = [NSURL URLWithString:urlFirst];// 一
NSURL *url = [NSURL URLWithString:urlSecon];// 二
NSURLRequest *request = [[NSURLRequest alloc]initWithURL:url];
[webview loadRequest:request];
[self.view addSubview:webview];
Ios 应用内唤起百度地图APP的方式
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 选择背景:由于地图的SDK一般较大,在app内部实现线路规划、导航等功能比较麻烦,而且耗时,所以就选择在app内部...