在我的didUpdateToLocation方法中,我获取位置更新,但当前位置的移动是一些什么干。MapView上的用户位置更新顺利
这是接收位置更新委托:
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLoc fromLocation:(CLLocation *)oldLoc
{
MKCoordinateRegion region;
region.center.latitude = newLoc.coordinate.latitude;
region.center.longitude = newLoc.coordinate.longitude;
region.span.latitudeDelta = 0.1;
region.span.longitudeDelta = 0.1;
[self.mapView setRegion:region animated:YES];
}
能否请你帮我确定如何获得平稳的位置更新?我在网上搜索,发现我们可以在ios5中使用跟踪模式来获得平滑的位置更新。如果是这种情况,那么我应该在当前的代码片段中做出什么改变。
如果我设置 [self.mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES]; 在视图中没有加载,那么我应该需要在位置更新中再次设置区域? 或者它会自动设置,因为我使用了usertrackingmode?
你可以显示你使用的'CLLocationManager'设置代码吗? – 2012-08-10 05:13:13
in viewDidLoad我输入了下面的代码self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; self.locationManager.distanceFilter = kCLDistanceFilterNone; [self.locationManager startUpdatingLocation]; – Sonal0706 2012-08-10 05:14:43
您可能希望将注释中的代码移至主要问题,以便将来发现此问题的其他人更清楚。 – 2012-08-10 05:23:07