I put a personal image instead of a traditional red pin. When I open the map to display a pin, the image covers the entire map. Is there a maximum pin image size, or how can I integrate something into the code so that it matches the standard classic size pins?
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 }
ios swift2 xcode7 mapkit mkannotation
Riccardo caroli
source share