我很難將選定註釋的標題傳遞給segued視圖控制器。我覺得這可能很簡單,我需要改變,但無法弄清楚。將註釋標題傳遞給視圖控制器(swift)
這裏是準備SEGUE代碼:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if(segue.identifier == "viewDetail"){
let theDestination : DetailViewController = segue.destinationViewController as! DetailViewController
theDestination.getName = view.annotation.title!
}
}
,這裏是代碼註釋時,召喚出被竊聽,它執行SEGUE
func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, calloutAccessoryControlTapped control: UIControl!) {
self.performSegueWithIdentifier("viewDetail", sender: self)
}
的問題是, ,在prepareForSegue函數..它不識別「view.annotation.title!」聲明UIView沒有成員「註釋」。
我知道當我在其他功能調用println(view.annotation.title!),它的工作原理
感謝您的幫助
你把這條線放在哪裏?我正在嘗試做同樣的事情,但無法弄清楚 – cfsprod