This is a bit unclear.
There is a method in this MKMapViewDelegate that should tell you when you start and finish dragging and dropping the annotation view. I did this:
- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)annotationView didChangeDragState:(MKAnnotationViewDragState)newState fromOldState:(MKAnnotationViewDragState)oldState { if (oldState == MKAnnotationViewDragStateStarting && newState == MKAnnotationViewDragStateEnding) { NSLog(@"Ending drag"); } if (newState == MKAnnotationViewDragStateStarting) { NSLog(@"Beginning drag"); } }
This type of work. However, when I stop dragging and dropping the annotation again, this method runs twice, then 3 times, etc. So, the console displays:
Beginning drag Ending drag Beginning drag Beginning drag Ending drag Ending drag Beginning drag Beginning drag Beginning drag Ending drag Ending drag Ending drag Beginning drag Beginning drag Beginning drag Beginning drag Ending drag Ending drag Ending drag Ending drag
Any ideas on what causes this?
source share