将数据从 Marker 传递给其他 VC [英] Passing data from Marker to other VC

查看:32
本文介绍了将数据从 Marker 传递给其他 VC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这篇文章的开头,我要感谢@Nirav D 的帮助:)

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

好的.所以问题来了.

我想通过带谷歌标记的prepareForSegue func 传递一个类.怎么做?

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

推荐答案

你太接近了,不能简单地使用你的数组对象设置passedMarker.

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]
}

现在只需访问 VC3viewDidLoad 中的 passedMarker 属性.

Now simply access passedMarker property in viewDidLoad of VC3.

这篇关于将数据从 Marker 传递给其他 VC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆