2015-05-04 80 views
0

我在創建從我的Map視圖到另一個View Controller的Segue時遇到問題。我希望用戶單擊註釋並彈出另一個視圖控制器。我無法在註釋印刷機和下一個視圖控制器之間創建輪廓。我從地圖視圖中將我的segue命名爲導航視圖Controller'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() 

     } 
    } 

enter image description here

回答

1

不應重寫功能performSegueWithIdentifier只是prepareForSegue

另外,prepareForSegue方法你的實現是錯誤的(如果你正在嘗試一些參數傳遞到目的地視圖控制器)。你需要像這樣

let vc = segue.destinationViewController as! MapRouteViewController 
+0

,我認爲你不應該創建的MapView一個SEGUE到detailviewcontroller(這是否在所有的工作?),但是從包含的MapView到detailviewcontroller的視圖 - 控制! –

相關問題