Contents

dragState

The drag state of the annotation view.

Declaration

var dragState: MKAnnotationView.DragState { get set }

Discussion

If your app runs in iOS 4.2 or later, override the setDragState(_:animated:) method and use it to manage the drag state instead.

To support drag operations, 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 when you finish performing animations. For example, when a drag operation begins for an annotation, the class executes an animation to lift the view off the map. Similarly, when the user drops the annotation, the class performs a drop animation. Even if you don’t perform any animations, it’s best practice to change the value of this property to reflect the correct state.

Don’t try to stop a new drag operation by changing the state from starting to none. If you don’t want your annotation view to be draggable, set the isDraggable property to false.

See Also

Supporting drag operations