2

I have an GMSOverlay in a GMSMapView, so I listen to taps into it with the method:

func mapView(_ mapView: GMSMapView, didTap overlay: GMSOverlay) {
    // Overlay was tapped
}

Then I want a GMSMarker to be painted over the GMSOverlay, and I listen to taps into it with the method:

func mapView(_ mapView: GMSMapView, didTap marker: GMSMarker) -> Bool {
    // Marker was tapped
    return false
}

Every time the listener of the marker is called, its info window hides (if it's shown) or shows (if it's hidden).

The problem is that the listener of the marker is not called every time I tap it.

Step by step:

  1. Tap in the marker:

    • The info window shows because the listener of the marker is called.
    • The listener of the overlay is not called.
  2. Tap in the marker:

    • The info window doesn't hides (it should) because the listener of the marker is not called.
    • The listener of the overlay is called (it shouldn't).
  3. Tap in the marker:

    • The info window hides because the listener of the marker is called.
    • The listener of the overlay is not called.
  4. Tap in the marker:

    • The info window doesn't show (it should) because the listener of the marker is not called.
    • The listener of the overlay is called (it shouldn't).
  5. Tap in the marker: step 1.

  6. Tap in the marker: step 2.

  7. Tap in the marker: step 3.

  8. Tap in the marker: step 4.

... and so on ...

In brief:

After the first tap, I need to tap two times the marker to hide or show the info window.

enter image description here

Sergio
  • 1,610
  • 14
  • 28
  • I know its late but I also faced same type of issue and solved it. Please take a look https://stackoverflow.com/a/65857592/2637953 – Poles Jan 23 '21 at 09:30

0 Answers0