Heestand XYZ
Heestand XYZ

Reputation: 2221

How to z-order MKAnnotationViews?

I've tried the two methods found in these stackoverflow posts without luck: post a, post b.

The methods are, a, to bring the view to front from the superview, b, to set the z postion of the layer of the view.

Dose anyone know a third way?

Upvotes: 3

Views: 1293

Answers (1)

Ryan Holmes
Ryan Holmes

Reputation: 367

Try setting anchorPointZ on the MKAnnotationView's layer. Keep in mind that higher values place the view lower in the stacking order.

annotationView.layer.anchorPointZ = 0

This works on macOS 10.13. I haven't tested yet on iOS 11, but MapKit is essentially identical on both platforms.

Upvotes: 4

Related Questions