5

I want to have some annotationView images appear on top of the others so they are easier to see. Is there a way to set the order?

I thought I would try something like

[theMap addAnnotations:arrayOfLessImportantItems];
[theMap addAnnotations:arrayOfMoreImportantItems];

But it is obvious after trying this that the delegate method MKMapViewDelegate mapView:viewForAnnotation doesn't observe any particular order when it puts them down. (Since the annotation views come from a pool, the delegate must be adding and removing annotationView images as the map is shifted around on the screen.)

But I do have a small number items that I want to be easier to see, and they are getting buried behind the less important map pins. Is there a way to overcome this?

Jim
  • 5,940
  • 9
  • 44
  • 91

1 Answers1

16

You could also use the zPosition property from CALayer (you will have to include QuatzCore.h) to change the z-index of the view.

yourView.layer.zPosition = 1;

Works just the way it would with html/css :)

smihael
  • 863
  • 13
  • 29