I have 1 pin on my map. I need to pass title of annotation to another UIView (which is ikinciEkran.swift in that case). But I am unable to do so.
Here is the segue part of my code and I do not know how to segue title of selected annotation.
I only pasted related part of the code.
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"
}
}