当我点击标签栏中的"Map"按钮时,它会弹出我的地图视图控制器,并显示用户在mapview上的当前位置(我使用以下代码):
[mapview setShowsUserLocation:YES];
超级容易。但如果我想让地图自动放大用户的当前位置,我该怎么做(在xCode中)?
谢谢:)
我想这就是你需要的
- (void)viewDidLoad
{
[super viewDidLoad];
self.mapView.showsUserLocation=YES;
self.mapView.delegate = self;
[self.mapView setUserTrackingMode:MKUserTrackingModeFollow animated:YES];
//some code
}
[mapview setUserTrackingMode:MKUserTrackingModeFollow];
这应该是你正在寻找的
MKCoordinateRegion region;
region = (MKCoordinateRegion){(current user location).location.coordinate, (current user location).locationCoordinateSpan};
[theMapView setRegion:region animated:NO/YES];