digdog / MapKitDragAndDrop
- Source
- Commits
- Network (3)
- Downloads (2)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitattributes | Fri Jul 24 11:50:48 -0700 2009 | |
| |
.gitignore | Tue Dec 22 21:41:51 -0800 2009 | |
| |
Classes/ | Mon Jan 18 15:27:49 -0800 2010 | |
| |
MapKitDragAndDrop.xcodeproj/ | Mon Jan 18 15:27:49 -0800 2010 | |
| |
MapKitDragAndDrop_Prefix.pch | Fri Jul 24 11:50:48 -0700 2009 | |
| |
README.markdown | Mon Jan 18 15:29:20 -0800 2010 | |
| |
Resources/ | Tue Dec 22 21:41:51 -0800 2009 | |
| |
main.m | Tue Dec 22 21:41:51 -0800 2009 |
README.markdown
MapKitDragAndDrop 2.1
MapKit sample for custom draggable AnnotationView with CoreAnimation pin lift/drop/bounce effects.
Features
- Draggable pin with CoreAnimation effects in the MapView
- Use CLLocationManager to find current position
- Use MKReverseGeocoder to lookup address
Design
- DDAnnotation is thin, just subclass from MKPlacemark, which also confirms to MKAnnotation protocol.
- DDAnnotation can be init'd with existing address info, so you won't need to reverse geocoding when creating the annotation.
- DDAnnotation re-declared MKAnnotation's readonly property 'coordinate' to readwrite-able. So you can update the coordinate after created.
- DDAnnotationView is subclassing from MKAnnotationView now, and using several pin images from MapKit.framework.
- To enable drag-and-drop, you must assign MKMapView instace to DDAnnotationView.
- DDAnnotationView now comes with CoreAnimation effects, including:
- Pin bounce when touched.
- Pin bounce and left for dragging.
- Pin drop and bounce when releasing the touch without moving.
- Pin lift, drop and bounce when releasing the touch after moving to the new position.
- DDAnnotationView won't do any animations unless MKMapView instance is assigned.
Issues
If you lookup too many times within a very short of period, you might get error from Apple/Google(so don't do this in your real world apps):
/SourceCache/ProtocolBuffer/ProtocolBuffer-19/Runtime/PBRequester.m:446 server returned error: 503Pin animations are almost perfect, but still need some works, I will kept things updated if possible.
License
This sample code is licensed under MIT license.
