-3

In Swift, I can add map annotation and display details using segue of a dropped pin when the user clicks the "i", but I am having trouble displaying details of multiple dropped pins using segue; unlike ViewTable no index is involved here. How do I do that?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Sam M.
  • 1
  • 2

1 Answers1

0

Can this give you some hint?

func mapView(mapView: MKMapView!, annotationView view: MKAnnotationView!, 
         calloutAccessoryControlTapped control: UIControl!) {
    //get the annotation ,maybe you need cast the type
    // let anno = view.annotation
    //performSegue here

}
ZHZ
  • 2,088
  • 13
  • 16
  • I am already doing this and it does show the details, but my problem is it only shows the details of the last dropped pin. How do I make it pass details of the tapped pin? – Sam M. Dec 01 '15 at 03:44
  • Have you passed the selected annotation's info or something to the detail viewController – ZHZ Dec 01 '15 at 03:50
  • I am using this: self.mapItemData = localSearchResponse?.mapItems.last to assign search data to the pin, and passing the info to the segue, it works well for a single pin but don't know how to assign this for multiple pins. mapItemData is MKMapItem – Sam M. Dec 01 '15 at 03:55
  • You should pass the selected mapItemData instead of the last one – ZHZ Dec 01 '15 at 03:57
  • How is that done, I am not familiar with this part of code. – Sam M. Dec 01 '15 at 04:00
  • can you post the viewForAnnotation method? – ZHZ Dec 01 '15 at 04:29