0
我在我的地圖上有註釋。我想在用戶點擊AccessoryControl並將數據傳遞給視圖控制器時打開一個新的視圖控制器。將數據傳遞給MapDetailViewController
所以我這樣做:
func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {
self.performSegueWithIdentifier("Details", sender: view)
}
則:
if segue.identifier == "Details" {
let placeDetailViewController = segue.destinationViewController as! PlaceDetailViewController
let place: Place = places[?index?]
placeDetailViewController.place = place
}
所以我想我的註釋的指標,不知道如何做到這一點。
幫助。謝謝。
不是字符串,但整個物體 – aaisataev
你可以註解爲您的**發件人屬性**(_view_您的例子)和將其設置爲** vc.annotation = sender.annotation **。或者創建任何其他財產 –