MKPinAnnotationView disable selection/highlight but not lift and drag

384 views Asked by At

I have a MKPinAnnotationView that I would like to be able to long press and drag around but not tap and select. Sometimes the user will touch just the right way (a short touch on the pin) and the pin will become highlighted (darkens) instead of lifting and dragging. I use the drag to show a magnifying glass so its a bit disruptive when the user touches a pin and drags but nothing happens.

Is there a flag of some kind I can set that prevents the pin from being tap selected and always goes to drag?

I've tried setting the following flags:

annotationView.selected = YES;
annotationView.canShowCallout = NO;
annotationView.highlighted = NO;

Which doesn't prevent the selection. I also tried flipping .selected to NO. I suppose I could override -(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView *)view but I'm not sure what I could put in there to bypass the selection. And there is no -(BOOL)shouldSelectAnnotationView... function.

1

There are 1 answers

0
Tony On

You will most likely have to subclass the pin. Here is the best example I could find. I can not write one as I am not at my computer. https://github.com/j4n0/callout

Good luck.