我正在尝试让我的MKMapView
放大到注释。我已经尝试了所有种类,但我仍然缩小到我的region
。
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
NSLog(@"Did add annotations");
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
MKCoordinateSpan span;
span.longitudeDelta = 0.02;
span.latitudeDelta = 0.02;
MKCoordinateRegion region;
region.center = mapView.userLocation.coordinate;
region.span = span;
[mapView selectAnnotation:mp animated:YES];
[self.spotMapView setRegion:region animated:YES];
[self.spotMapView regionThatFits:region];
}
哪个会运行,但地图会缩小。
答案 0 :(得分:0)
将didAddAnnotationViews
更改为:
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views
{
NSLog(@"Did add annotations");
MKAnnotationView *annotationView = [views objectAtIndex:0];
id <MKAnnotation> mp = [annotationView annotation];
[mapView selectAnnotation:mp animated:NO];
}
似乎要做的伎俩,地图现在放大。