<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCollectionView/draggingImageForItems(at:with:offset:)-7rc4k",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCollectionView(im)draggingImageForItemsAtIndexPaths:withEvent:offset:"
  },
  "title" : "draggingImageForItems(at:with:offset:)"
}
-->

# draggingImageForItems(at:with:offset:)

Returns an image to use for dragging the specified items.

```
func draggingImageForItems(at indexPaths: Set<IndexPath>, with event: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage
```

## Parameters

`indexPaths`

The set of <doc://com.apple.documentation/documentation/Foundation/NSIndexPath> objects corresponding to the items being dragged.

`event`

The mouse-down event that began the drag operation.

`dragImageOffset`

The offset value to use when positioning the image. On input, the point is <doc://com.apple.documentation/documentation/Foundation/NSZeroPoint>, which centers the returned image under the mouse. Custom implementations can return a different point that repositions the drag image by the specified offset values.

## Return Value

The image to use for the dragged items.

## Discussion

The default implementation of this method creates an image using the visible portions of the dragged items. The resulting image is a snapshot of the dragged items as they currently appear in the collection view but rendered with additional transparency to indicate they are part of a drag operation. This method also updates the `dragImageOffset` parameter to an appropriate point for dragging the resulting image.

If the delegate implements the [`collectionView(_:draggingImageForItemsAt:with:offset:)`](/documentation/AppKit/NSCollectionViewDelegate/collectionView(_:draggingImageForItemsAt:with:offset:)-898js) method, the collection view method obtains the drag image from that method instead. If the delegate does not implement that method, the collection view uses the image returned by this method.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)