mapbox / mapbox-annotation-extension

Framework extensions that can be used with the Mapbox Maps SDK for iOS.
ISC License
11 stars 18 forks source link

Unable to detect taps for annotations when using multiple MGLAnnotationControllers #35

Closed captainbarbosa closed 4 years ago

captainbarbosa commented 4 years ago

When using multiple MGLAnnotationControllers, if both controllers have interactions enabled only the first one initialized will respond to tap gestures. Here's an example that exhibits the behavior:

let symbolAnnotationController = MGLSymbolAnnotationController(mapView: mapView)
symbolAnnotationController.annotationsInteractionEnabled = true
symbolAnnotation = MGLSymbolStyleAnnotation(coordinate: CLLocationCoordinate2D(latitude: 50, longitude: 50))
symbolAnnotationController.add(symbolAnnotation)

let circleAnnotationController = MGLCircleAnnotationController(mapView: mapView)
circleAnnotationController.annotationsInteractionEnabled = true
circleAnnotation = MGLCircleStyleAnnotation(coordinate: CLLocationCoordinate2D(latitude: 25, longitude: 25))
circleAnnotationController.add(symbolAnnotation)

With this setup, -[MGLMapViewDelegate didSelect:annotation:], will only be called for the annotations within the MGLSymbolAnnotationController, which is unexpected.

fabian-guerra commented 4 years ago

Fixed in https://github.com/mapbox/map-extensions-ios/pull/36