我很难将选定注释的标题传递给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