Instance Property

dragState

The current drag state of the annotation view.

Declaration

var dragState: MKAnnotationView.DragState { get set }

Discussion

Applications targeting iOS 4.1 and earlier can use this property to support drag operations in custom annotation views. If your application runs in iOS 4.2 or later, you should override the setDragState(_:animated:) method and use it to manage the drag state instead.

To support drag operations, you must override the implementation of this property and update the drag state at the following times:

Changing the state to the MKAnnotationView.DragState.dragging or MKAnnotationView.DragState.none value is the way to signal to the map view that you are done with any animations you wanted to perform. For example, when a drag operation begins for a pin annotation, the MKPinAnnotationView class executes an animation to lift the pin off the map. Similarly, when the pin is dropped, the class performs a drop animation. Even if you do not perform any animations, you should still change the value of this property to reflect the correct state.

You must not try to abort a new drag operation by changing the state from MKAnnotationView.DragState.starting to MKAnnotationView.DragState.none. If you do not want your annotation view to be draggable, set the isDraggable property to false.

See Also

Supporting Drag Operations

var isDraggable: Bool

A Boolean indicating whether the annotation view is draggable.

func setDragState(MKAnnotationView.DragState, animated: Bool)

Sets the current drag state for the annotation view.