从GMSMapView中删除GMSPolyline [英] Remove GMSPolyline from GMSMapView
问题描述
我使用GoogleMap-IOS-1.8.1 SDK来显示地图。我必须在地图上绘制可能的GMSPolyline。在发生特定事件后,我只能删除所有GMSPolyline,那么我该怎么做......?
由于GoogleMaps / documentation / ios声称使用两种方法来完成它。
I am using GoogleMap-IOS-1.8.1 SDK for showing map. I have to draw may GMSPolyline on map. After on a particular event i have to remove only all GMSPolyline, so how can i do that...? As GoogleMaps/documentation/ios say to use two method to do it.
1. [mapView_ clear];
2. Set your GMSPolyline's map property to nil
第1种方法删除所有Marker和Overlay以及。这是我不想要的。
而对于第二个,我不认为这是保存所有poliline参考的好方法。然后将其设置为零。有没有更好的方法来做到这一点.... ??
Here 1st approach remove all Marker and Overlay as well. which is i don't want. And for 2nd one i don't think that it is good way to save all poliline's reference. and then set it to nil. Is there any better way to do it....??
这里我想要做的。
for (GMSPolyline *polylineToremove in mapView_.polyline)
{
[mapView_ removeOverlay:overlayToRemove];
}
推荐答案
您只需要设置GMSPolyline地图属性为零。
You just need to set GMSPolyline map property to nil.
GMSPolyline *polyline;
polyline.map = nil;
这篇关于从GMSMapView中删除GMSPolyline的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!