Instance Method

collectionView:draggingImageForItemsAtIndexes:withEvent:offset:

Creates and returns a drag image to represent the specified items during a drag.

Declaration

- (NSImage *)collectionView:(NSCollectionView *)collectionView draggingImageForItemsAtIndexes:(NSIndexSet *)indexes withEvent:(NSEvent *)event offset:(NSPointPointer)dragImageOffset;

Parameters

collectionView

The collection view making the request.

indexes

The indexes of the items being dragged.

event

The mouse-down event that initiated the drag.

dragImageOffset

An in/out parameter that is initially set to NSZeroPoint, which causes the image to be centered under the mouse. The value can be modified to reposition the returned image.

Return Value

The image to use for the dragged items.

Discussion

If the delegate does not implement this method, the collection view uses the image returned by draggingImageForItemsAtIndexes:withEvent:offset:.

You do not need to implement this method for your collection view to be a drag source.

See Also

Legacy Collection View Support

- collectionView:canDragItemsAtIndexes:withEvent:

Returns a Boolean indicating whether the collection view can begin dragging the specified items.

- collectionView:pasteboardWriterForItemAtIndex:

Provides the pasteboard writer for the item at the specified index

- collectionView:writeItemsAtIndexes:toPasteboard:

Invoked after it has been determined that a drag should begin, but before the drag has been started.

Deprecated
- collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:

Invoked to return an array of filenames that the receiver promises to create.

Deprecated
- collectionView:draggingSession:willBeginAtPoint:forItemsAtIndexes:

Notifies your delegate that a drag session is about to begin.

- collectionView:validateDrop:proposedIndex:dropOperation:

Validates the specified location to see if it is a valid drop target.

- collectionView:acceptDrop:index:dropOperation:

Invoked when the mouse is released over a collection view that previously allowed a drop.