I've a problem with the size of a custom MKAnnotationView. I set a custom image but when the zoom of the MKMapView change the size of the annotation don't. I lost the default behaviour of the annotation like disappear in term of the zoom, resizing etc.. Thanks for help.
My Custom Annotation :
class CustomPointAnnotation: MKPointAnnotation {
var pinCustomImageName:String!
var index : Int! }
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let reuseIdentifier = "pin"
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseIdentifier)
annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseIdentifier)
annotationView?.canShowCallout = true;
let customPointAnnotation = annotation as! CustomPointAnnotation
var image = UIImage(named: customPointAnnotation.pinCustomImageName)
annotationView?.image = image
annotationView!.isEnabled = true
annotationView!.canShowCallout = true
return annotationView
}
Edit : I just wanna my annotation view resize when I zoom in or out the map. And when I am far the annoatation disapear.