Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Annotation callout view dissappears when centering map within mapView:didSelectAnnotation delegate #3103

Closed
tentrr-de opened this issue Nov 23, 2015 · 3 comments
Labels
bug iOS Mapbox Maps SDK for iOS

Comments

@tentrr-de
Copy link

I am trying to center the map when the annotation image is clicked. However, mapView:setCenterCoordinate: call within the didSelectAnnotation delegate hides the annotation from the mapview.

func mapView(mapView: MGLMapView, leftCalloutAccessoryViewForAnnotation annotation: MGLAnnotation) -> UIView? {
    let view = UIImageView(frame:CGRect(x: 0, y: 0, width: 30, height: 30))
    view.image = UIImage(named: "some_image")
    return view
}

func mapView(mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool {
    return true
}

func mapView(mapView: MGLMapView, didSelectAnnotation annotation: MGLAnnotation) {
    self.mapView.setCenterCoordinate(
                annotation.coordinate,
                zoomLevel: 8,
                animated: true)

    self.resultScrollView.scrollTo(annotation)
}
@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS labels Nov 23, 2015
@RomainQuidet
Copy link
Contributor

it's working on current version on master for me

@tentrr-de
Copy link
Author

Sorry - I was reffering to the annotaion call out view, not the annotation.

@friedbunny friedbunny changed the title Annotation dissappears when centering map within mapView:didSelectAnnotation delegate Annotation callout view dissappears when centering map within mapView:didSelectAnnotation delegate Jan 21, 2016
@friedbunny
Copy link
Contributor

#3249

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug iOS Mapbox Maps SDK for iOS
Projects
None yet
Development

No branches or pull requests

4 participants