选择标记时,将当前标记标题传递给VC

时间:2016-04-05 08:42:50

标签: ios swift dictionary

我试图在另一个VC中传递所选位置的名称。 我试图这样做

func mapView(mapView: MKMapView, annotationView: MKAnnotationView, calloutAccessoryControlTapped control: UIControl) {

    if control == annotationView.rightCalloutAccessoryView {

        performSegueWithIdentifier("showInfo", sender: data)
    }
}


override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "showInfo" {
        let destination = segue.destinationViewController as! InfoViewController

        destination.name = location.name
    }
}

"位置"是我地图中显示的所有位置的数组。

我的问题是它总是通过"位置"的第一行。而不是选择标记。

如何获得当前的标记?感谢。

0 个答案:

没有答案