0
votes

Platfrom: iOS (Swift) Mapbox SDK version: 3.6

Hi, I have a custom MGLCalloutView, when I tap on a MGLAnnotationView the callout appears as expected just above the annotation, but if I move the map slightly the callout moves slight and drops down covering the annotation. One the callout has dropped it does stay anchored to that point as you move the map.

Ive implemented isAnchoredToAnnotation, I'm not sure if this a bug or Ive implemented something wrong. I noticed in the docs it says implement setCentre, so Ive set the centre in presentCallout

self.center = CGPoint(x: frameWidth / 2, y: frameHeight / 2)
self.isAnchoredToAnnotation = true
1

1 Answers

0
votes

Managed to figure it out, the centre was being updated when you panned the map, overriding Get/Set for the views centre fixed the issue.

override var center: CGPoint {

    set {
            var newCenter = newValue
            newCenter.y = newCenter.y - bounds.midY
            super.center = newCenter
       }

    get {

        return super.center

    }

}