足球游戏_中国足彩网¥体育资讯$

ios如何根据经纬度坐标取详细地址
来源:易贤网 阅读:1051 次 日期:2015-02-03 14:28:48
温馨提示:易贤网小编为您整理了“ios如何根据经纬度坐标取详细地址”,方便广大网友查阅!

以当前手机为例:

获取当前手机地址,再从经纬度转换成详细地址(包括:国家名-国家代码,省,市,街道名,邮政代代码等)。

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 mark -#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];}

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看技术文章
易贤网手机网站地址:ios如何根据经纬度坐标取详细地址
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标