点击标记时如何删除Google地图上的形状(圆形)? [英] How to delete the shape(circle) on google map when tap on marker?

查看:169
本文介绍了点击标记时如何删除Google地图上的形状(圆形)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在"didTapAt"事件中在Google地图上添加许多标记和圆圈,但是我也想删除它们,对于标记,我可以在"didTap marker"事件中进行此操作,但是我怎样才能删除其形状呢?形状?

I can add many markers and circles on google map with in "didTapAt" event, but I want to delete them as well, for markers I can do this in "didTap marker" event but how can I delete its shape not other shape?

推荐答案

let circle = GMSCircle(position: CLLocationCoordinate2D(latitude: 40.7336299, longitude: 30.1616061, radius: 10)
 circle.isTappable = true
 circle.map = mapView

func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {
    overlay.map = nil
}

这篇关于点击标记时如何删除Google地图上的形状(圆形)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆