2012-10-26 2 views
0

MKMapView을 확대/축소하려고 시도 중입니다. 그러나 나는 모든 것을 시도했지만 내 region에 축소 된 상태로 남아 있습니다.iOS6 MKMapView 줌

- (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

은 왜 region.center 대신 주석 (MP)의 userLocation로 설정되고있다.? – Anna

+0

좋은 질문입니다. 나는 실제로 확신하지 않는다. .. 나는 월요일에 그것을 바꾸어야 할 것이다! – James

답변

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

이 트릭을 할 듯,지도 지금에 확대