标签:
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationController.navigationBarHidden = YES;
_mapView = [[MAMapView alloc] init];
_mapView.frame =CGRectZero;
[self.view addSubview:_mapView];
_mapView.showsUserLocation = YES;
}
-(void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation
updatingLocation:(BOOL)updatingLocation
{
NSLog(@"didUpdateUserLocationdidUpdateUserLocationdidUpdateUserLocation");
CLLocation *currentLocation = userLocation.location;
if(updatingLocation)
{
//取出当前位置的坐标
NSLog(@"latitude : %f,longitude: %f ",userLocation.coordinate.latitude,userLocation.coordinate.longitude);
// [userLocation.]
}
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
for (CLPlacemark *place in placemarks) {
// UILabel *label = (UILabel *)[self.window viewWithTag:101];
// label.text = place.name;
NSLog(@"name,%@",place.name); // 位置名
NSLog(@"thoroughfare,%@",place.thoroughfare); // 街道
NSLog(@"subThoroughfare,%@",place.subThoroughfare); // 子街道
// // NSLog(@"locality,%@",place.locality); // 市
// // NSLog(@"subLocality,%@",place.subLocality); // 区
// // NSLog(@"country,%@",place.country); // 国家
}
}];
}
标签:
原文地址:http://www.cnblogs.com/lude/p/4626390.html