Passing data from Marker to other VC

故事扮演 提交于 2019-12-12 02:08:01

问题


At the beggining of this post I would like thank @Nirav D for help :)

Ok. So the problem.

There is a class i want to pass with prepareForSegue func with google marker. How to do it?


回答1:


You are too close to pass simply set the passedMarker with your array object.

if let marker = sender as? GMSMarker , //is it correct do declare marker as GMSMarker?
   let dict = marker.userData as? [String:Int] {

    let markerIndex = dict["index"]!
    nextVC.passedMarker = self.markers[markerIndex]
}

Now simply access passedMarker property in viewDidLoad of VC3.




回答2:


Edit this performSegue(withIdentifier: "details", sender: marker)

To performSegue(withIdentifier: "details", sender: self)



来源:https://stackoverflow.com/questions/42876232/passing-data-from-marker-to-other-vc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!