如何通过点击地图来识别国家?

时间:2012-10-22 09:49:17

标签: objective-c ios mapkit

例如,触摸地图的某个区域,然后看到包含国家名称的警报,点击

2 个答案:

答案 0 :(得分:2)

谢谢大家想通了

CLLocation *location = [[CLLocation alloc] initWithLatitude:55.755773 longitude:37.617761];
CLGeocoder *geocoder = [CLGeocoder new];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
    CLPlacemark *placemark = [placemarks objectAtIndex:0];

    NSLog(@"%@ %@ %@ %@ %@ %@ %@ %@", placemark.country, placemark.ISOcountryCode, placemark.postalCode, placemark.administrativeArea, placemark.locality, placemark.subLocality, placemark.thoroughfare, placemark.subThoroughfare);
}];

答案 1 :(得分:1)

搜索“反向地理编码”