我有很多公交车站标记在地图上。我想要使用公交车站标志的图像而不是默认的红色气泡或针,所以我成功地更改了图像。
在这样做时,因为图像大小为512x512,我决定使用变换来缩放MKAnnotationView。因此,当我选择一个公交车站时,呼出的气泡现在也被缩放到相同的级别,这使得它难以阅读。
有没有办法只缩放图像而不缩放calloutView?
我的代码:
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
}