我想手动添加注释(当用户触摸地图视图中的特定位置时)并获取该位置的详细信息(纬度,经度,地址)..
答案 0 :(得分:0)
正如@iPrabu指向similar post,对你的问题有非常好的和正确的答案......对于第二部分,即获得有关该位置的详细信息......你可以做这样的事情
-(void)getAddressFromCurruntLocation:(CLLocation *)location{
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error)
{
if(placemarks && placemarks.count > 0)
{
CLPlacemark *placemark= [placemarks objectAtIndex:0];
NSString *address = [NSString stringWithFormat:@"%@ %@",[placemark country],[placemark administrativeArea]];
// you may also get locality,sublocality,subadministrativeare etc
NSLog(@"The Address Is:%@",address);
}
}];
}
快乐编码:)