0
地图视图似乎无法跟踪我的位置。如果当前位置正在移出地图的可见区域,则地图视图不会自动平移。MapView不会跟踪用户位置
我在视图上拖放地图视图,并在IB中将“显示用户位置”属性设置为true。
当我的视图控制器的负载,我设置地图视图的区域如下
- (void)viewDidLoad {
[super viewDidLoad];
MKCoordinateRegion region;
region.center = aCoordinate;
region.span = MKCoordinateSpanMake(0.0625, 0.0625);
[mapView setRegion:region animated:YES];
}
我也有以下方法,该方法将当前位置设置为地图的中心。
- (void)panToCurrentLocation:(id)sender
{
[mapView setCenterCoordinate:mapView.userLocation.coordinate animated:YES];
mapView.showsUserLocation = YES;
}
当我移动时,地图视图仍然没有跟踪我的位置。如果当前位置移出可见区域,则地图视图不会平移。过了一段时间后,当前位置会从屏幕上移开,因为地图视图不会自动平移。
我需要地图视图在我移动时自动平移。
不,它不会调用该方法。我的印象是地图视图会自动平移。我正在用小驱动来测试它。 – iJK 2011-03-18 03:26:54