zoukankan      html  css  js  c++  java
  • 调用系统路线导航

    想参考米途订酒店客户端来做酒店地图那一块,调用系统的地图来标示出导航路线;
    于是找了下例子,
    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的东西;没仔细研究过

  • 相关阅读:
    iOS开发多线程篇 03 —线程安全
    【Objective-C】01-Objective-C概述
    insert小细节,大问题
    高速修复汉澳sinox命令解释程序bash shell漏洞
    load-on-startup 解释
    研究下JavaScript中的Rest參数和參数默认值
    UVALive 6530 Football (水
    Android多线程分析之五:使用AsyncTask异步下载图像
    POJ2407_Relatives【欧拉phi函数】【基本】
    cocos2d-x 下使用加密 sqlite3
  • 原文地址:https://www.cnblogs.com/neworiginou/p/2860617.html
Copyright © 2011-2022 走看看