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 want to change the marker color or image when it being selected and change it back when another marker select or the marker deselect.
Thank you.
The doco for selectedMarker
says:
The marker that is selected. Setting this property selects a
particular marker, showing an info window on it. If this property is
non-nil, setting it to nil deselects the marker, hiding the info
window. This property is observable using KVO.
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.