Contents

Drag and Drop

Support the direct manipulation of your app’s content using drag and drop.

Overview

With very little programming on your part, custom-view objects can be dragged and dropped anywhere. Objects become part of this dragging mechanism by conforming to dragging protocols: Draggable objects conform to the NSDraggingSource protocol, and destination objects (that is, receivers of a drop) conform to the NSDraggingDestination protocol. AppKit hides all the details of tracking the cursor and displaying the dragged image.

To learn how to use drag and drop for an image view, see Supporting Drag and Drop Through File Promises. To use drag and drop in a table view, see Supporting Table View Drag and Drop Through File Promises. For an example of drag and drop in a collection view, see Supporting Collection View Drag and Drop Through File Promises, and for an outline view: Navigating Hierarchical Data Using Outline and Split Views.

Topics

Drag Sources

Drop Targets

See Also

User Interactions