iphone 根据经纬度坐标取详细地址(包括国,省,市,街道)
2010-12-19 07:19:44 来源:WEB开发网以当前手机为例:
获取当前手机地址,再从经纬度转换成详细地址(包括:国家名-国家代码,省,市,街道名,邮政代代码等)。
1:获取当前手机经纬度
Reverse geoder Class
1:- (void)startedReverseGeoderWithLatitude:(double)latitude longitude:(double)longitude{ CLLocationCoordinate2D coordinate2D; coordinate2D.longitude = longitude; coordinate2D.latitude = latitude; // if (self.locationInfo == nil) { self.locationInfo = [[[Location alloc] init] autorelease]; } self.locationInfo.latitude = latitude; self.locationInfo.longitude = longitude; // MKReverseGeocoder *geoCoder = [[MKReverseGeocoder alloc] initWithCoordinate:coordinate2D]; geoCoder.delegate = self; [geoCoder start];}#pragma mark -#pragma mark MKReverseGeocoderDelegate methods- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFindPlacemark:(MKPlacemark *)placemark { NSLog(@"reverse finished..."); NSLog(@"country:%@",placemark.country); NSLog(@"countryCode:%@",placemark.countryCode); NSLog(@"locality:%@",placemark.locality); NSLog(@"subLocality:%@",placemark.subLocality); NSLog(@"postalCode:%@",placemark.postalCode); NSLog(@"subThoroughfare:%@",placemark.subThoroughfare); NSLog(@"thoroughfare:%@",placemark.thoroughfare); NSLog(@"administrativeArea:%@",placemark.administrativeArea); self.locationInfo.locationName = [NSString stringWithFormat:@"%@ %@,%@ %@,%@", placemark.country, placemark.administrativeArea, placemark.locality, placemark.subLocality, placemark.thoroughfare]; NSLog(@"administrativeArea:%@",self.locationInfo.locationName); [self.target performSelector:self.callBack withObject:@"0"]; geocoder = nil;}- (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog(@"error %@" , error); [self.target performSelector:self.callBack withObject:@"1"];}
2:获取当前手机经纬度的, 详细地址。
Current location class
-(void) startUpdatingLocation{ // Start the location manager. [[self
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
- ››iPhone 获取指定格式的时间和日期
- ››iPhone版PPS走进生活 观赏体验媲美PC版
- ››iPhone两种不同的应用程序:两种方法的哲学思想
更多精彩
赞助商链接