0

Is it possible to manage z-index of MGLAnnotationView in iOs? The yellow and green annotations are supposed to be over blue ones in the attached screenshot. I add the annotation view in this way :

var annotationView = mapView2.dequeueReusableAnnotationView(withIdentifier: reuseIdentifier)
if annotationView == nil {
    annotationView = CustomAnnotationView(reuseIdentifier: reuseIdentifier)
    switch reuseIdentifier {
    case "NP" :
        let animageView = UIImageView(image: imageGreen)
        annotationView?.addSubview(animageView)

        //annotationView?.bringSubview(toFront: annotationView!)
            break

 (...)

Thanks a lot!

mathmax
  • 5
  • 2

1 Answers1

2

The z-index can be set using the following line of code:

annotationView?.layer.zPosition = 3

the higher the number is, the closer it is to the user

aroth
  • 365
  • 1
  • 10