• 调用系统路线导航


    想参考米途订酒店客户端来做酒店地图那一块,调用系统的地图来标示出导航路线;
    于是找了下例子,
    NSString *theString = [NSString stringWithFormat:@"http://maps.google.com/maps?saddr=Current Location&daddr=%f,%f",Location.latitude, Location.longitude];
        theString =  [theString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
       
        NSURL *url = [[NSURL alloc] initWithString:theString];
        [[UIApplication sharedApplication] openURL:url];
    这段代码就是调用自带的googlemap,模拟器显示的是webView,真机显示才会是调用系统的东西;


    NSString *urlString = [[NSString alloc]
         initWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f&dirfl=d",
            curLocation.latitude,
            curLocation.longitude,
            stationLocation.latitude,
            stationLocation.longitude];

    NSURL *aURL = [NSURL URLWithString:urlString];
    [urlString release];
    [[UIApplication sharedApplication] openURL:aURL];

    调用这个貌似也一样,但是比前面那个网址多了个&dirfl=d,没什么区别,我也是网上看到的别人写的,不知道这里的不同会不会有什么区别,目前从效果上是没看到任何区别的;


     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",loc.latitude,loc.longitude,中国山东济南市某某街某某号]]];
    出发地选用的参数为经纬度,可以通过手机gps获得(具体实现在下篇),目的地可以是位置名称,也可以是经纬度(没用过)。http://blog.sina.com.cn/s/blog_68eb52b3010141pe.html

    目的地可以是位置名称,不一定是经纬度;

    刚开始用这个 http://maps.apple.com/maps?saddr=%f,%f&daddr=%f,%f  原来这个是不可用的;
    参考 http://www.cnblogs.com/zhulin/archive/2012/11/09/2761926.html


    另外 画线路图有个什么overlay的东西;没仔细研究过

  • 相关阅读:
    NOI2021游记-记最后一段日子
    7.20 ZROI-Day7模拟赛
    7.19 ZROI-Day6模拟赛
    7.18 ZROI-Day5模拟赛
    7.17 ZROI-Day4模拟赛
    7.16 ZROI-DAY3 模拟赛
    7.15 ZROI-DAY2 模拟赛
    7.13 ZROI-DAY1赛后总结
    7.9模拟赛赛后总结
    7.7模拟赛赛后总结
  • 原文地址:https://www.cnblogs.com/neworiginou/p/2860617.html
Copyright © 2020-2023  润新知