The recommended way of handling this is to make your own class that implements the MKAnnotation protocol and has a property that you can check during viewForAnnotations
to see what colour to use. The annotations
array from MKMapView is not guaranteed to be in the order in which you add annotations to the map. You may add annoy, annoy and then annoy but you may get back [anno2, anno3, anno1]. That's just the way it is and you can't change that. So, you could keep your own array of annotations that won't get rearranged. Or use the extra property idea if that will suit.
One thing you should not do is add more annotations during the viewForAnnotation
function, that's really messed up.