La taille de l'image pin annotation

J'ai mis l'image au lieu de la traditionnelle rouge pin. Quand j'ai ouvert la carte pour afficher le pin, l'image de couverture de l'ensemble de la carte. Est-il une taille maximale de la broche de l'image ou comment puis-je intégrer quelque chose dans le code pour l'adapter à la taille standard classique nip?

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    if annotation is MKUserLocation {
        return nil
    }

    let annotationIdentifier = "SomeCustomIdentifier" //use something unique that functionally identifies the type of pin

    var annotationView: MKAnnotationView! = mapView.dequeueReusableAnnotationViewWithIdentifier(annotationIdentifier)

    if annotationView != nil {
        annotationView.annotation = annotation
    } else {
        annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: annotationIdentifier)

        annotationView.image = UIImage(named: "pin maps.png")

        annotationView.canShowCallout = true
        annotationView.calloutOffset = CGPointMake(-8, 0)

        annotationView.autoresizesSubviews = true
        annotationView.rightCalloutAccessoryView = UIButton(type: UIButtonType.DetailDisclosure) as UIView
    }

    return annotationView
}

OriginalL'auteur Riccardo Caroli | 2015-10-21