3
我在地图上有1个针脚。我需要将注释的标题传递给另一个UIView(在这种情况下是ikinciEkran.swift)。但我无法这样做。Swift - 执行地图注释中的Segue
这里是我的代码的segue部分,我不知道如何缩减选定注释的标题。
我只粘贴了代码的相关部分。
class MapViewController: UIViewController, CLLocationManagerDelegate, MKMapViewDelegate {
@IBOutlet weak var mapView: MKMapView!
@IBOutlet weak var lbl_Name: UILabel!
@IBOutlet weak var lbl_Address: UILabel!
@IBOutlet weak var lbl_Phone: UILabel!
var LocationManager = CLLocationManager()
var i = 0
var annotation:MKAnnotation!
override func viewDidLoad() {
super.viewDidLoad()
LocationManager.delegate = self
mapView.delegate = self
LocationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
LocationManager.requestWhenInUseAuthorization()
LocationManager.startUpdatingLocation()
let tekel1 = TekelClass(
title: "tekel1",
locationName: "Tekelİsim1",
coordinate: CLLocationCoordinate2D(latitude: 40.9400, longitude: 29.300520))
mapView.addAnnotation(tekel1)
}
func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!,
calloutAccessoryControlTapped control: UIControl!) {
if control == view.rightCalloutAccessoryView {
performSegueWithIdentifier("toTheMoon", sender: self)
}
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "toTheMoon")
{
var ikinciEkran = segue.destinationViewController as! DetailViewController
ikinciEkran.tekelName = "how to segue title of the selected pin"
}
}
亲爱的耿介,如何Segue公司销的称号?在你的github例子中,没有任何东西被传递。 –