zoukankan      html  css  js  c++  java
  • iOS 使用CLGeocoder获取地理位置

    placemark(MKPlacemark类的对象)其实是geocoder(MKReverseGeocoder类的对象)的一个属性。从geocoder里面取placemark这个和直接取placemark这个其实区别不大。而我们需要的信息主要就在这个里面了。

    // 这个字典存放基础数据

    @property (nonatomic, readonly) NSDictionary *addressDictionary;

    让我们试试看,能从这个字典里面倒出来些什么东西。

    以下是我用这个addressDictionary属性倒出来的字典。我们分析看看。

    {

        City = "U897fU5b89U5e02";// 城市名字

        Country = "U4e2dU56fd";// 国家名字

        CountryCode = CN;// 国家编码

        FormattedAddressLines =     (

            "U4e2dU56fd",

            "U9655U897fU7701U897fU5b89U5e02U96c1U5854U533a",

            "U9ad8U65b0U516dU8def34U53f7"

        ); // 这个应该是格式化后的地址了

        State = "U9655U897fU7701"; // 省

        Street = "U9ad8U65b0U516dU8def 34U53f7";// 街道完整名称

        SubLocality = "U96c1U5854U533a";//区名 

       SubLocality = "U6816U971eU533a";

        SubThoroughfare = "34U53f7";//具体地址

        Thoroughfare = "U9ad8U65b0U516dU8def";//街道名称

    }

     

    注意:上面的这个字典是可以直接转化为联系人的字典的,通过这个ABCreateStringWithAddressDictionary属性。

     

    以下是placemark的其他属性。大家可以随意取用。

    // address dictionary properties

    @property (nonatomic, readonly) NSString *name; // eg. Apple Inc.

    @property (nonatomic, readonly) NSString *thoroughfare; // street address, eg. 1 Infinite Loop

    @property (nonatomic, readonly) NSString *subThoroughfare; // eg. 1

    @property (nonatomic, readonly) NSString *locality; // city, eg. Cupertino

    @property (nonatomic, readonly) NSString *subLocality; // neighborhood, common name, eg. Mission District

    @property (nonatomic, readonly) NSString *administrativeArea; // state, eg. CA

    @property (nonatomic, readonly) NSString *subAdministrativeArea; // county, eg. Santa Clara

    @property (nonatomic, readonly) NSString *postalCode; // zip code, eg. 95014

    @property (nonatomic, readonly) NSString *ISOcountryCode; // eg. US

    @property (nonatomic, readonly) NSString *country; // eg. United States

    @property (nonatomic, readonly) NSString *inlandWater; // eg. Lake Tahoe

    @property (nonatomic, readonly) NSString *ocean; // eg. Pacific Ocean

    @property (nonatomic, readonly) NSArray *areasOfInterest; // eg. Golden Gate Park

     

  • 相关阅读:
    Ubuntu下通过makefile生成静态库和动态库简单实例
    C++获取Windows7 32位系统中所有进程名(类似于任务管理器中的进程)
    剑指offer(一)
    Leetcode题解(一)
    C Run-Time Error R6034问题的解决
    windows环境中利用NMake工具编译连接C++源代码
    通过命令行使用cl.exe编译器
    [bzoj3709] [PA2014]Bohater
    [bzoj3714] [PA2014]Kuglarz
    [bzoj2724] [Violet 6]蒲公英
  • 原文地址:https://www.cnblogs.com/niit-soft-518/p/4052366.html
Copyright © 2011-2022 走看看