Search code examples
iphoneobjective-ciosios4ios-simulator

MkMapView drop a pin on touch


I am struggling to unearth a standard way to drop a pin on a MkMapView based on a touch input. There probably isnt a standard way, but it is always worth asking. If I have to implement this myself is the best approach to add a Gesture Recogniser to pick up a tap on the map view.


Solution

  • Yes, you can use a UILongPressGestureRecognizer to do this.

    This previous answer of mine has details with sample code:
    How to add a push pin to a MKMapView(IOS) when touching?

    To animate the drop, in viewForAnnotation, return an MKPinAnnotationView with animatesDrop set to YES.