注釈を実行するためにSegueを実行しようとしていますが、このコードは異なるインデックスを生成し、間違った場所がdetailsViewに表示されます。どのようにこれを修正することが可能かを知ることは素晴らしいことでしょう。注釈のインデックスを見つけるMapKit
おかげ
var detailsDict = [NSDictionary]()
var selectedPlace: NSDictionary!
func mapView(_ mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
if (view.annotation?.isKind(of: PlaceAnnotation.self))! {
let annotation = view.annotation
let index = (self.mapView.annotations as NSArray).index(of: annotation!)
let place = detailsDict[index]
selectedPlace = place
performSegue(withIdentifier: "showMuseumDetails", sender: self)
}
}