0
我想删除现有的从谷歌地图的所有标记,我们可以通过map.clear
做,但我不希望删除一切(折线,多边形)在地图上,我只是想只删除标记如何删除所有标记从GoogleMap的不mapview.clear(IOS的Objective-C)
我创建基于阵列的标记算
-(void)annotationCreationForCoordinatesOfArray:(NSMutableArray *)array
{
for (int i=0; i<array.count; i++)
{
CLLocationCoordinate2D position = CLLocationCoordinate2DMake([[[array objectAtIndex:i] objectForKey:@"latitude"] doubleValue], [[[array objectAtIndex:i] objectForKey:@"longitude"] doubleValue]);
mark = [GMSMarker markerWithPosition:position];
NSString *annoNumber = [NSString stringWithFormat:@"%i",i];
mark.title = annoNumber;
mark.map = _mapView;
mark.tracksViewChanges = YES;
mark.draggable = YES;
mark.icon = [UIImage imageNamed:@"Mappin.png"];
}
}
让你的特异性标志物'nil'。 –
如果我设置标记=零,或marker.map =零唯一的最后一个标记被删除 –
没有,为此,你必须为每个标记设置ID,然后获取特定的标记,然后无它。 –