我有地圖視圖,它設置爲放大用戶當前位置。問題是,如果用戶在查看地圖時更改位置,則會放大回當前位置。這使得我無法使用我計劃要做的功能。我將在地圖上有多個引腳,但如果位置發生變化,用戶將無法查看所有這些引腳。即使當我的設備坐在我的桌子上時,位置也會不斷變化,因此地圖始終將用戶從他們正在查看的地圖的任何部分帶回到其當前位置的縮放視圖。有沒有人有任何想法呢?放大當前位置在地圖視圖
- (void)foundLocation:(CLLocation *)loc
{
CLLocationCoordinate2D coord = [loc coordinate];
// Zoom the region to this location
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(coord, 250, 250);
[worldView setRegion:region animated:YES];
[activityIndicator stopAnimating];
[locationManager stopUpdatingLocation];
}
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
CLLocationCoordinate2D loc = [userLocation coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 250, 250);
[worldView setRegion:region animated:YES];
}
停止移動第一事件後的地圖......你應該在獲取用戶位置後定位地圖。如果您需要幫助,請顯示您如何定位它的代碼。 – iwasrobbed 2013-05-03 22:51:06