iOS6 MKMapView Zoom

时间:2012-10-26 15:30:01

标签: ios6 mkmapview ios6-maps

我正在尝试让我的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];
}

哪个会运行,但地图会缩小。

1 个答案:

答案 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];
}

似乎要做的伎俩,地图现在放大。