Tag: Swift Mapkit

如何在Swift 3.0中通过Segue传递variables和对象

这是我的设置:ViewController – > SecondViewControoler 三目标: 添加图像到自定义注释(见下面的代码) 我有一个名为“资本”的子类,我想在#1中添加图像,然后创build额外的variables来保存将传递到一个新的SecondViewController,其中包括(2)标签和select器视图的值:例如label1 = “text1”,label2 =“text2”,然后从包含多个对象的数组中获取一个string(即Picker的每一行的标题) 一旦用户点击定制引脚上的标注button,我们将ViewController推送到名为“SecondViewController”的新ViewController,并将附加到自定义引脚上的子类“Capital”的值分配给新标签和Picker View在SecondViewController中 这是我迄今为止的代码: 名为“Capital.swift”的子类 import MapKit import UIKit class Capital: NSObject, MKAnnotation { var title: String? var coordinate: CLLocationCoordinate2D var info: String // here we would add the custom image in Goal #1 // here we would add the (2) values for label1 and label2 […]