SKYnine
SKYnine

Reputation: 2708

Draw route on pin touch mapkit swift

I did some research and didn't find any information about this. Im working on a map with pin markers and I would like to show the route (direction) when the user touch a pin.

I already have the working code but I can't find a way to trigger this when the pin is touched (when the annotation appears), but only when touching a button inside this annotation.

Am I missing something here? a delegate function or something?

Thanks,

Upvotes: 0

Views: 617

Answers (1)

SKYnine
SKYnine

Reputation: 2708

As always, I find my information right after I ask a question... So for those who need the information too:

To trigger touch event when tapping on a mapkit pin, you just need to use this MKMapViewDelegate function:

func mapView(mapView: MKMapView!,
        didSelectAnnotationView view: MKAnnotationView!){

            println("Selected annotation")
    }

Upvotes: 2

Related Questions