Skip to content

[TIMOB-1242] Support to draggable annotations (Drag & Drop) #1670

merged 5 commits into from Apr 23, 2012

4 participants


This commit, makes support to make draggable annotations.
When you create an annotation, you just have to set the "draggable" property (boolean) and it will works.

When you drag and drop the annotation, will fire an event called pinchangedragstate. This event will return the new state and the old state from the annotation.

The coordinates from the annotation is changed automatically.



@rafaelks Thanks for updating this :) We will get back to reviewing ASAP


This is a reopen of #1193, Signed CLA is in place

@vishalduggal vishalduggal and 2 others commented on an outdated diff Mar 15, 2012
+- (NSString *)annotationViewDragStateToString:(MKAnnotationViewDragState)state
+ switch(state)
+ {
+ case MKAnnotationViewDragStateStarting:
+ return @"starting";
+ case MKAnnotationViewDragStateDragging:
+ return @"dragging";
+ case MKAnnotationViewDragStateCanceling:
+ return @"canceling";
+ case MKAnnotationViewDragStateEnding:
+ return @"ending";
+ }
+ return @"none";
vishalduggal added a note Mar 15, 2012

All these string constants must be defined as constants in the MapModule. Use the MAKE_SYSTEM_STR macro.

rafaelks added a note Mar 23, 2012

I don't understood how to do it. I need to define the strings (@"starting", etc) or the constants (MKAnnotationViewDragStateStarting, etc..) ?

And when I define the constants, how can I use on this source?

mattapperson added a note Mar 23, 2012

MAKE_SYSTEM_PROP(AnnotationDragStarting, MKAnnotationViewDragStateStarting);
placed outside of any method would be an example

rafaelks added a note Mar 23, 2012

Understood. So, the strings (@"starting", etc) will continue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Code reviewed. One small fix required otherwise looks good.


@rafaelks FYI looks like we just need one minor fix and we can continue to process your PR :)


I really need help to use the MapModule. How I have to do, exactly?


MapModule.h (Declare Properties)
@property(nonatomic,readonly) NSNumber *ANNOTATION_DRAG_STATE_NONE;
@property(nonatomic,readonly) NSNumber *ANNOTATION_DRAG_STATE_START;
@property(nonatomic,readonly) NSNumber *ANNOTATION_DRAG_STATE_DRAG;
@property(nonatomic,readonly) NSNumber *ANNOTATION_DRAG_STATE_CANCEL;
@property(nonatomic,readonly) NSNumber *ANNOTATION_DRAG_STATE_END;

MapModule.m (Define Properties)

Remove annotationViewDragStateToString method.
Modify event dictionary as follows
NSDictionary * event = [NSDictionary dictionaryWithObjectsAndKeys:


OK, I declared and use the constants.
Thanks @vishalduggal.


Code Reviewed. ACCEPTED


Functional Passed. Tested on IOS Sim (4.3, 5.0, 5.1) and ipod 3rd gen (4.0.2). ACCEPTED

@vishalduggal vishalduggal merged commit 162d608 into appcelerator:master Apr 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.