私はdidSelect view: MKAnnotationView
で、ピンの色を変更しようとしています:スウィフト:didSelectビューの変更ピンの色:MKAnnotationView
func mapView(_ mapView: MKMapView,
didSelect view: MKAnnotationView) {
let selectedAnnotation = view.annotation as? MKPointAnnotation //ColorPointAnnotation
//self.textField.text = selectedAnnotation!.title
preferredSpot = selectedAnnotation!.title!
view.tintColor = UIColor.green
}
をしかし、私はピンをタップしたときに、それが変化していないが - 赤のまま。なぜ誰かがそれを変更する方法を知っていますか?
の –
@ElenaRubilovaあなたをあなたのMKAnnotationViewをMKPinAnnotationViewにキャストする必要があります、あなたはKosukeの答えに従うことができます;) –