api手机版:百度手机地图api中怎么获得当前位置所属省市

太平洋在线 174 0

  //首先你要有经纬度api手机版,这个自己定位出来或者从服务器获取固定的都行,然后加BMKSearchDelegate

#import "BMKGeocodeTypeapi手机版。h" //加上这个头文件,地理编码和反地理编码要用上

BMKSearch *search = [[BMKSearch alloc]init];

searchapi手机版

  delegate = self;

CLLocationCoordinate2D pt = (CLLocationCoordinate2D){0,0};

pt=(CLLocationCoordinate2D){coordinatex,coordinatey};

NSLog(@"搜索成功?:%d",[search reverseGeocode:pt]);

//上面代码会执行下面的事件

- (void)onGetAddrResult:(BMKAddrInfo*)result errorCode:(int)error{

//具体位置

if (error == 0) {

if (resultapi手机版

  addressComponentapi手机版。streetName!=nil&&result。addressComponent。streetNumber!=nil) {

//具体位置

address = [NSString stringWithFormat:@"当前位置:%@%@",resultapi手机版

  addressComponentapi手机版。streetName,result。addressComponent。streetNumber];

}else{

//具体位置

address = [NSString stringWithFormat:@"当前位置:%@",resultapi手机版

  strAddr];

}api手机版

标签: 省市 所属 获得 位置 当前

抱歉,评论功能暂时关闭!