我创建了一些叠加层:
//additionally draw an overlay
MKCircle *circle = [MKCircle circleWithCenterCoordinate:choosenCountry.coordinate radius:choosenCountry.placeMark.region.radius/4];
circle.title = @"test";
[_mapView addOverlay:circle];
和:
-(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id)overlay
{MKCircleView* circleView = [[MKCircleView alloc] initWithOverlay:overlay];
circleView.fillColor = [[UIColor cyanColor] colorWithAlphaComponent:0.2];
circleView.strokeColor = [[UIColor blueColor] colorWithAlphaComponent:0.7];
circleView.lineWidth = 2;
return circleView;}
但是现在,不知何故我需要删除它们,但我不能:
- (void)clearOverlays{
NSArray *overlayCountries = [self.mapView overlays];
[self.mapView removeOverlays:overlayCountries];
}
你知道,这是怎么做到的吗?谢谢!