查找当前位置的坐标并找出国家

时间:2011-08-08 16:40:11

标签: objective-c ios cocoa-touch mkmapview

是否有可能找出我当前位置的坐标并找出它所在的国家/地区?

1 个答案:

答案 0 :(得分:0)

  

MKReverseGeocoder类提供将地图坐标(指定为纬度/经度对)转换为有关该坐标的信息的服务,例如国家/地区,城市或街道。

MKReverseGeocoder *reverseGeocoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate];
reverseGeocoder.delegate = self;
[reverseGeocoder start];

然后你需要实现MKReverseGeocoderDelegate协议。这是获取信息后调用的委托方法:

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
    // get the country string from placemark.country and use however you want.
}
相关问题