WEB开发网
开发学院手机开发iPhone 开发 根据经纬度坐标取详细地址(包括国,省,市,街道... 阅读

根据经纬度坐标取详细地址(包括国,省,市,街道,号)

 2010-12-30 04:38:20 来源:WEB开发网   
核心提示: 首页完成改版,来提意见43 NSLog(@"获取失败!");44 }45@end2: 获取当前手机经纬度的详细地址view sourceprint?01@implementation AddressReverseGeoder0203#pragma mark --04#pragma mark Pu
首页完成改版,来提意见

43 NSLog(@"获取失败!");

44 }

45@end

2: 获取当前手机经纬度的详细地址

view sourceprint?01@implementation AddressReverseGeoder

02

03#pragma mark --

04#pragma mark Public

05//根据经纬度开始获取详细地址信息

06- (void)startedReverseGeoderWithLatitude:(double)latitude longitude:(double)longitude{

07 CLLocationCoordinate2D coordinate2D;

08 coordinate2D.longitude = longitude;

09 coordinate2D.latitude = latitude;

10 //

11 MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate2D];

12 geoCoder.delegate = self;

13 [geoCoder start];

14}

15#pragma mark --

16#pragma mark MKReverseGeocoderDelegate methods

17//获得地址信息

18- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark {

19 NSString *address = [NSString stringWithFormat:@"%@ %@ %@ %@ %@%@",

20 placemark.country,

21 placemark.administrativeArea,

22 placemark.locality,

23 placemark.subLocality,

24 placemark.thoroughfare,

25 placemark.subThoroughfare];

26 NSLog(@"经纬度所对应的详细:%@", address);

27 geocoder = nil;

28}

29//错误处理

30- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error {

31 NSLog(@"error %@" , error);

32}

33#pragma mark --

34#pragma mark Memory management

35- (void)dealloc {

36 [super dealloc];

37}

38@end

上一页  1 2 

Tags:根据 经纬度 坐标

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接