Instance Method


Provides the pasteboard writer for the item at the specified index


- (id<NSPasteboardWriting>)collectionView:(NSCollectionView *)collectionView pasteboardWriterForItemAtIndex:(NSUInteger)index;



The collection view making the request.


The index of the item requiring a pasteboard writer.

Return Value

The pasteboard writer object to use for managing the item data. Return nil to prevent the collection view from dragging the item.


The collection view calls this method for each item involved in the drag operation after it has determined that a drag should begin but before the drag operation has started. Your implementation of this method should create and return the pasteboard writer—an object conforming to the NSPasteboardWriting protocol—to use for providing the item’s data. Using the object you provide, the collection view creates an NSDraggingItem object for you and configures its draggingFrame and imageComponents properties for you using information from the item at the specified index path.

If you implement this method, the collection view does not call the collectionView:draggingImageForItemsAtIndexes:withEvent:offset: of your delegate or the draggingImageForItemsAtIndexes:withEvent:offset: method of NSCollectionView.

See Also

Legacy Collection View Support

- collectionView:canDragItemsAtIndexes:withEvent:

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

- collectionView:writeItemsAtIndexes:toPasteboard:

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

- collectionView:namesOfPromisedFilesDroppedAtDestination:forDraggedItemsAtIndexes:

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

- collectionView:draggingImageForItemsAtIndexes:withEvent:offset:

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

- 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.