【发布时间】:2018-01-26 11:02:18
【问题描述】:
所以我有许多在地图上标记为注释的巴士站。我想使用公共汽车站标志的图像,而不是默认的红色气泡或图钉,因此我成功更改了图像。
这样做时,因为图像是 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
}
【问题讨论】:
标签: swift swift3 mapkit mkannotation mkannotationview