---
title: "draggingImageForItems(at:with:offset:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nscollectionview/draggingimageforitems(at:with:offset:)-951w7"
---

# draggingImageForItems(at:with:offset:)

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

## Declaration

```swift
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 doc://com.apple.documentation/documentation/Foundation/NSZeroPoint. it can be modified to reposition the returned image. A dragImageOffset of doc://com.apple.documentation/documentation/Foundation/NSZeroPoint will cause the image to be centered under the mouse.

## Return Value

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

## Discussion

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

- [itemPrototype](appkit/nscollectionview/itemprototype.md)
- [newItem(forRepresentedObject:)](appkit/nscollectionview/newitem(forrepresentedobject:).md)
- [selectionIndexes](appkit/nscollectionview/selectionindexes.md)
- [maxNumberOfRows](appkit/nscollectionview/maxnumberofrows.md)
- [maxNumberOfColumns](appkit/nscollectionview/maxnumberofcolumns.md)
- [minItemSize](appkit/nscollectionview/minitemsize.md)
- [maxItemSize](appkit/nscollectionview/maxitemsize.md)
- [item(at:)](appkit/nscollectionview/item(at:)-80xze.md)
- [frameForItem(at:)](appkit/nscollectionview/frameforitem(at:).md)
- [frameForItem(at:withNumberOfItems:)](appkit/nscollectionview/frameforitem(at:withnumberofitems:).md)
- [setDraggingSourceOperationMask(_:forLocal:)](appkit/nscollectionview/setdraggingsourceoperationmask(_:forlocal:).md)
