Contents

draggingImageForItems(at:with:offset:)

This method computes and returns an image to use for dragging.

Declaration

func draggingImageForItems(at indexes: IndexSet, with event: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage

Parameters

  • indexes:

    The index set of the items to be dragged.

  • event:

    Mouse drag event.

  • dragImageOffset:

    An in/out parameter that will initially be set to Nszeropoint. it can be modified to reposition the returned image. A dragImageOffset of Nszeropoint will cause the image to be centered under the mouse.

Return Value

An image containing a rendering of the visible portions of the views for each item.

Discussion

You can override the default image by subclassing NSCollectionView and overriding this method, or by implementing the collectionView(_:draggingImageForItemsAt:with:offset:) delegate method, it will be preferred over this method.

See Also

Legacy Collection View Support