Reputation: 5
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!
Upvotes: 0
Views: 800
Reputation: 365
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
Upvotes: 2