I added an MKAnnotationView on an MKMapView, when I long press on it, I hope it can be lifted and move to another location.
How to? Special thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For iOS 4.0 or later
From Apple’s Location Awareness Guide > Marking Your Annotation View as Draggable:
Implementing setCoordinate:
Creating the annotation view in the view controller:
For any iOS version
Track the user touches and move the pin view accordingly. Look at DDAnnotationView at the bottom of this page: http://digdog.tumblr.com/post/252784277/mapkit-annotation-drag-and-drop-with-callout-info
When the user stops dragging convert the view position to map coordinates and change the annotation coordinates. Throw in some animations for the pin.
Here is a working example : https://github.com/digdog/MapKitDragAndDrop Try adding the classes DDAnnotationView and DDAnnotation to your project, and using the MKMapViewDelegate methods below this line.