0

我在创建从地图视图到另一个视图控制器的 segue 时遇到问题。我希望用户单击注释并弹出另一个视图控制器。我无法在注释按下和下一个视图控制器之间创建转场。我将我的 segue 从地图视图命名为导航视图控制器“annotationPress”。每当我单击地图上的注释时,我都会得到一个全黑的新视图控制器。任何意见,将不胜感激。

    func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, calloutAccessoryControlTapped control: UIControl!)
    {
//        performSegueWithIdentifier("annotationPress", sender: view)
    }


    override func performSegueWithIdentifier(identifier: String?, sender: AnyObject?) {
        println("segueing...")
        if identifier == "annotationPress"
        {

        }

    }
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        if segue.identifier == "annotationPress"
        {
            println("hello")
            var vc = MapRouteViewController()

        }
    }

在此处输入图像描述

4

1 回答 1

1

performSegueWithIdentifier你不应该只覆盖函数prepareForSegue

此外,prepareForSegue您的实现方法是错误的(如果您试图将一些参数传递到目标视图控制器)。你需要这样的东西

let vc = segue.destinationViewController as! MapRouteViewController
于 2015-05-04T20:15:40.333 回答