zoukankan      html  css  js  c++  java
  • iOS判断并使用百度地图 高德地图 导航 (使用URI,不集成sdk)

    [objc] view plaincopy 
    1. BOOL hasBaiduMap = NO;  
    2.         BOOL hasGaodeMap = NO;  
    3.           
    4.         if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"baidumap://map/"]]){  
    5.             hasBaiduMap = YES;  
    6.         }  
    7.         if ([[UIApplication sharedApplication]canOpenURL:[NSURL URLWithString:@"iosamap://"]]){  
    8.             hasGaodeMap = YES;  
    9.         }  
    10.       
    11.   
    12.     if ([@"使用百度地图导航" isEqualToString:title])  
    13.         {  
    14.             NSString *urlString = [[NSString stringWithFormat:@"baidumap://map/direction?origin=latlng:%f,%f|name:我的位置&destination=latlng:%f,%f|name:终点&mode=driving",currentLat, currentLon,_shopLat,_shopLon] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] ;  
    15.               
    16.             [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];  
    17.         }  
    18.         else if ([@"使用高德地图导航" isEqualToString:title])  
    19.         {  
    20.             NSString *urlString = [[NSString stringWithFormat:@"iosamap://navi?sourceApplication=%@&backScheme=%@&poiname=%@&lat=%f&lon=%f&dev=1&style=2",@"app name", yourscheme, @"终点", _shopLat, _shopLon] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];  
    21.   
    22.             [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];  
    23.         }  
  • 相关阅读:
    Beans
    HDU 1175 连连看
    HDU 1241 Oil Deposits dfs && bfs
    HDU1312:Red and Black
    背包问题
    canvas 和 svg
    前端性能优化---DOM操作
    四种常见的 POST 提交数据方式
    [转]浏览器缓存详解: expires, cache-control, last-modified, etag详细说明
    URL和URI
  • 原文地址:https://www.cnblogs.com/GhostKZShadow/p/5105227.html
Copyright © 2011-2022 走看看