1

MKMapView に追加されたすべての注釈を削除する必要がありますが、実行すると:

NSMutableArray *annotationsToRemove = [[NSMutableArray alloc] initWithArray: mapView.annotations];
[mapView removeAnnotations: annotationsToRemove];

配列 annotationsToRemove には注釈が含まれておりMKUserLocation、それは削除されません。

マップをリセットする方法はありますか?そこからすべての注釈を削除する必要があります。

4

3 に答える 3

0

h挿入で

@property (weak)   MKAnnotationView *ulv;

m 挿入で

 - (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated {

        MKZoomScale currentZoomScale = mapView.bounds.size.width / mapView.visibleMapRect.size.width;
        NSLog(@"current zoom scale is %f",currentZoomScale);

        ulv = [mapView viewForAnnotation:mapView.userLocation];
                if( currentZoomScale > 0.049 ){
                    ulv.hidden = YES;
                }else{
                    ulv.hidden = NO;
                }

    }
于 2016-02-14T08:43:59.540 に答える