实施 MKReverseGeocoderDelegate
implements <MKReverseGeocoderDelegate>
Run Code Online (Sandbox Code Playgroud)
添加实例变量:
MKReverseGeocoder *_reverseGeocoder;
Run Code Online (Sandbox Code Playgroud)
创建反向地理编码器对象:
CLLocationCoordinate2D location;
location.latitude = latitude; // You said you had this value
location.longitude = longitude; // You said you had this value
_reverseGeocoder = [[MKReverseGeocoder alloc]initWithCoordinate:location];
_reverseGeocoder.delegate = self;
[_reverseGeocoder start];
Run Code Online (Sandbox Code Playgroud)
实现以下委托功能:
- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark
{
/// placemark has your location!
}
Run Code Online (Sandbox Code Playgroud)