地图定位的坐标和mapview中显示的当前位置信息不一致

// 准确打开方式ios

- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation {git

    CLLocationCoordinate2D coordinate=userLocation.coordinate;//位置坐标get

    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(coordinate, 500, 500);//定位放大it

 

      [self.mapView setRegion:region animated:YES];io

}date

 

//有偏差的打开方式map

-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{im

    CLLocation *location=[locations firstObject];//取出第一个位置stackoverflow

    CLLocationCoordinate2D coordinate=location.coordinate;//位置坐标top

    NSLog(@"经度:%f,纬度:%f,海拔:%f,航向:%f,行走速度:%f",coordinate.longitude,coordinate.latitude,location.altitude,location.course,location.speed);

    

    //若是不须要实时定位,使用完即便关闭定位服务

    [_locationManager stopUpdatingLocation];

    MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(coordinate, 500, 500);//定位放大

    [self.mapView setCenterCoordinate:coordinate animated:YES];

    [self.mapView setRegion:region animated:YES];

 }

连接

http://stackoverflow.com/questions/8802973/ios-difference-between-the-location-i-get-from-cllocationmanager-and-mkmapview

相关文章
相关标签/搜索