国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

ios如何根據經緯度坐!標取詳細地址

2019-11-02 14:22:25
字體:
來源:轉載
供稿:網友

   以當前手機為例:

  獲取當前手機地址,再從經緯度轉換成詳細地址(包括:國家名-國家代碼,省,市,街道名,郵政代代碼等)。

  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. [[selflocationManager] startUpdatingLocation]; }#pragma m

無憂無慮電影網[www.aikan.tv/special/wuyouwulvdianyingwang/]
ark -#pragma mark Location manager/** Return a location manager -- create one if necessary. */- (CLLocationManager *)locationManager { if (locationManager != nil) { return locationManager; } locationManager = [[CLLocationManager alloc] init]; [locationManager setDesiredAccuracy:kCLLocationAccuracyNearestTenMeters]; [locationManager setDelegate:self]; return locationManager;}/** Conditionally enable the Add button: If the location manager is generating updates, then enable the button; If the location manager is failing, then disable the button. */- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { [self.target performSelector:self.callBack withObject:@"0"];}- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { [self.target performSelector:self.callBack withObject:@"1"];}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 榆社县| 滨州市| 洱源县| 连州市| 澄江县| 漳平市| 息烽县| 海淀区| 汉源县| 油尖旺区| 双峰县| 钦州市| 上高县| 南靖县| 上栗县| 宽甸| 恭城| 独山县| 惠来县| 鹤岗市| 汉源县| 新河县| 上饶市| 六枝特区| 抚松县| 东丰县| 义乌市| 疏勒县| 磴口县| 井陉县| 临漳县| 策勒县| 司法| 孟村| 禄丰县| 桃园县| 海安县| 建瓯市| 双城市| 深圳市| 蓬溪县|