在我的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