开发者

How to get current Region Name using Coordinates?

开发者 https://www.devze.com 2022-12-11 13:02 出处:网络
I just need current location details, I have done the part of getting Current location Coordinates. Now i want to get the region name, etc (No Maps) details using these coordinates.

I just need current location details,

I have done the part of getting Current location Coordinates.

Now i want to get the region name, etc (No Maps) details using these coordinates.

开发者_C百科How to do that? Any sample code available?

Thanks in advance.


implement the MKReverseGeocoderDelegate

implements <MKReverseGeocoderDelegate>

Add an instance variable:

MKReverseGeocoder *_reverseGeocoder;

Create your reverse geocoder object:

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];

Implement the following delegate function:

- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark  
{
    /// placemark has your location!
}


You can use MKReverseGeocoder.

0

精彩评论

暂无评论...
验证码 换一张
取 消