无法从地图中删除叠加视图

时间:2012-08-02 11:32:31

标签: ios overlay mkoverlay

我创建了一些叠加层:

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

你知道吗,这怎么办?谢谢!

0 个答案:

没有答案