在地图上显示Pins之前将其移除

时间:2011-08-15 07:34:58

标签: ios route-me

在地图上显示Pins之前,我必须确保将它们从地图中删除,以便永远不会显示它,因为显示的过程放在viewWillAppear方法中。我的相关代码是:

    -(void)viewWillAppear:(BOOL)animated{

            //before doing anything, i want to remove all Pins
            RMMarkerManager *markerManager=[mapView markerManager];
            [mapView setDelegate:self];
        [mapView setBackgroundColor:[UIColor grayColor]];
        [mapView moveToLatLong:currentLocation];
        [mapView.contents setZoom: 13];
        [self.view addSubview:mapView];
        RMMarker *marker=[[RMMarker alloc] initWithUIImage:[UIImage imageNamed:@"marker-blue.png"]];
        [marker setTextForegroundColor:[UIColor blueColor]];
        [marker changeLabelUsingText:@"Vous êtes ici"];
        [markerManager addMarker:marker
                       AtLatLong:currentLocation];
    [marker release];
    }

我该怎么办?提前谢谢

1 个答案:

答案 0 :(得分:1)

可以通过调用removeMarkers的{​​{1}}方法来完成,所以就是这样:

RMMarkerManager