vivek bhoraniya
vivek bhoraniya

Reputation: 1535

How to set draggable Map pin

I am developing an application in which I have included MapKit. When first map is loaded at the time pin will be located at predefine place. And at that time drag-gable property of pin is set to NO. Now I want to do this.. When user press button Edit it will allow user to drag pin. And when user drag pin and locate it at new place it will show user pin location name and lat long.

Upvotes: 1

Views: 315

Answers (1)

Zack Brown
Zack Brown

Reputation: 6028

MKAnnotationView exposes the property draggable which can be set to enable dragging of each annotation added to map view.

The documentation for MKAnnotationView states:

If YES, the associated annotation object must also implement the setCoordinate: method. The default value of this property is NO.

Subclass MKAnnotationView and implement the setCoordinate method.
Then in your mapView:viewForAnnotation: method, set the draggable property to YES.

Upvotes: 1

Related Questions