Sat*_*yam 2 mapkit ios clgeocoder
默认情况下,我们可以在地图视图中显示用户的位置.点击注释引脚时,它将显示"当前位置".但我想将用户的地址显示为街道,城市和国家.我怎么能用CLGeoCoder课来做呢?
小智 6
做这样的事情:
CLGeocoder *gc = [[[CLGeocoder alloc] init] autorelease];
[gc reverseGeocodeLocation:locationObject completionHandler:^(NSArray *placemark, NSError *error) {
CLPlacemark *pm = [placemark objectAtIndex:0];
NSDictionary *address = pm.addressDictionary;
// do something with the address, see keys in the remark below
}];
Run Code Online (Sandbox Code Playgroud)
以及相关文档:http: //developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLPlacemark_class/Reference/Reference.html#//apple_ref/occ/instp/CLPlacemark/addressDictionary
| 归档时间: |
|
| 查看次数: |
1722 次 |
| 最近记录: |