iOS:MKMapView 在加载时自旋
iOS: MKMapView spins on load
我有一个简单的地图视图,只显示用户的当前位置。我的问题是地图会旋转,就好像它在加载时试图弄清楚哪条路是北。它也会在加载自身时放大和缩小。它最终确实停下来并且看起来不错,但我想摆脱这种开始旋转和抽搐的情况。我可以添加一些东西来解决这个问题吗?
地图代码:
在视图中加载:
self.mapView.showsUserLocation=YES;
self.mapView.delegate = self;
[self.mapView setMapType:MKMapTypeHybrid];
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES];
我也有这个方法:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 500, 500);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
}
谢谢!
你用过,
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES]; // notice animated is yes
在动画中输入否,
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO];
我有一个简单的地图视图,只显示用户的当前位置。我的问题是地图会旋转,就好像它在加载时试图弄清楚哪条路是北。它也会在加载自身时放大和缩小。它最终确实停下来并且看起来不错,但我想摆脱这种开始旋转和抽搐的情况。我可以添加一些东西来解决这个问题吗?
地图代码:
在视图中加载:
self.mapView.showsUserLocation=YES;
self.mapView.delegate = self;
[self.mapView setMapType:MKMapTypeHybrid];
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES];
我也有这个方法:
- (void)mapView:(MKMapView *)mapView didUpdateUserLocation:(MKUserLocation *)userLocation
{
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(userLocation.coordinate, 500, 500);
[self.mapView setRegion:[self.mapView regionThatFits:region] animated:YES];
}
谢谢!
你用过,
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:YES]; // notice animated is yes
在动画中输入否,
[self.mapView setUserTrackingMode:MKUserTrackingModeFollowWithHeading animated:NO];