在Google Maps SDK for iOS中点击另一个标记时,我可以拦截标记取消选择吗? [英] Can I intercept marker deselect when I tap another marker in Google Maps SDK for iOS?

查看:88
本文介绍了在Google Maps SDK for iOS中点击另一个标记时,我可以拦截标记取消选择吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用 didTapAtCoordinate ,当我点击地图上的其他地方时,将取消选择标记。
但是如果有多个标记并且我点击另一个(例如MarkerA - > MarkerB),那么当前一个标记DidDeselect?时是否有任何回调?
我在 GMSMapView 中环顾四周但找不到任何可以使用的东西。

I know that I can use didTapAtCoordinate that will deselect the marker when I tap else where on the map. But If there are multiple marker and I tap another one (Ex. MarkerA -> MarkerB), Is there any call back when the previous marker DidDeselect?. I look around in GMSMapView the but can't find any thing I can use.

I想要在选择时更改标记颜色或图像,并在另一个标记选择或标记取消选择时将其更改回来。

I want to change the marker color or image when it being selected and change it back when another marker select or the marker deselect.

谢谢。

推荐答案

doco selectedMarker 说:


标记是选择。设置此属性会选择
特定标记,并在其上显示信息窗口。如果此属性为
非零,则将其设置为nil取消选择标记,隐藏info
窗口。 使用KVO可以观察到此属性。

因此,您可以使用键值观察,以便通知 selectedMarker 。如果在设置KVO时使用 NSKeyValueObservingOptionOld (更详细地描述此处),您将收到旧值的通知,即取消选择的标记。

So, you could use Key Value Observing to be notified of changes to selectedMarker. If you use NSKeyValueObservingOptionOld when setting up KVO (described in more detail here), you will be notified of the old value, ie the marker which was deselected.

这篇关于在Google Maps SDK for iOS中点击另一个标记时,我可以拦截标记取消选择吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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