简体   繁体   中英

Get all GMSMarker from mapview and remove all marker without using mapview.clear()

I have drawn path with marker in google map. So the path is static but marker needs to change their positions. How can I remove all markers without using mapview.clear() , because it will clear my path also from the map.

Any solution?

I guess you will have to keep all markers in an array(eg. allMarkers ). Then,

for marker in allMarkers {
    marker.map  = nil
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM