Custom marker image on swift (MapKit)
I am using a custom marker on MapKit
How do I change the width and height of the image on a custom marker?
my code:
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView! {
if (annotation is MKUserLocation) {
return nil
}
let reuseId = "test"
var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView.image = UIImage(named:"x2.png")
anView.canShowCallout = true
}
else {
anView.annotation = annotation
}
return anView
}
+3
source to share