So I have a number of bus stops that are marked as annotations on the map. Instead of the default red bubble or the pin, I wanted to use an image of a bus stop sign, so I successfully changed the image.
In doing so, because the image is 512x512, I decided to scale the MKAnnotationView using transform. Consequently, when I select a bus stop, the callout bubble is now also scaled to the same level, which makes it unreadable.
Is there any way I could just scale the image without scaling the calloutView?
My code:
func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
let annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "stopPin")
annotationView.canShowCallout = true
annotationView.image = UIImage(named: "busStop.png")
let transform = CGAffineTransform(scaleX: 0.25, y: 0.25)
annotationView.transform = transform
return annotationView
}