Is there a way to add an ID or something, that i am able to set custom marker images?
I have multiple markers with numbers, and i need that every new marker has another image.
For example:
marker1 - marker_1_image
marker2 - marker_2_image
Atm i am only able to set 1 image (globaly) to all markers:
func mapView(mapView: MGLMapView, imageForAnnotation annotation: MGLAnnotation) -> MGLAnnotationImage? {
var annotationImage = mapView.dequeueReusableAnnotationImageWithIdentifier("place")
if annotationImage == nil {
var image = UIImage(named: "marker_1")!
image = image.imageWithAlignmentRectInsets(UIEdgeInsetsMake(0, 0, image.size.height/2, 0))
annotationImage = MGLAnnotationImage(image: image, reuseIdentifier: "place")
}
return annotationImage
}
Any ideas? Or can i subclass MGLAnnotation and use that for all delegate methods?