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

# draggingImageForItems(at:with:offset:)

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

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

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:)`](/documentation/AppKit/NSCollectionViewDelegate/collectionView(_:draggingImageForItemsAt:with:offset:)-4yvk5) delegate method, it will be preferred over 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)