mapbox / mapbox-annotation-extension

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

When tapping on MGLSymbolStyleAnnotation the weird default icon is shown behind it #68

Closed TarasOsiris closed 4 years ago

TarasOsiris commented 4 years ago

I have created a simple MGLSymbolStyleAnnotation with an icon image, but when this annotation is selected it animates some default icon which I can't figure out where it comes from. How do I get rid of this icon behind?

image

captainbarbosa commented 4 years ago

@TarasOsiris This is a known issue - you'll need to pass an MGLAnnotationView in the implementation for mapView(_ mapView:viewFor annotation:) as we do in the demo app here:

extension MapViewController: MGLMapViewDelegate {
    // This is required in order to hide the default Maps SDK pin
    func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? {
        return MGLAnnotationView(frame: CGRect(x: 0, y: 0, width: 10, height: 10))
    }
}
TarasOsiris commented 4 years ago

@captainbarbosa Thanks for the swift response! I see.