<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTableView/dragImageForRows(with:tableColumns:event:offset:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTableView(im)dragImageForRowsWithIndexes:tableColumns:event:offset:"
  },
  "title" : "dragImageForRows(with:tableColumns:event:offset:)"
}
-->

# dragImageForRows(with:tableColumns:event:offset:)

Computes and returns an image to use for dragging.

```
func dragImageForRows(with dragRows: IndexSet, tableColumns: [NSTableColumn], event dragEvent: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage
```

## Parameters

`dragRows`

An index set containing the row indexes that should be in the image.

`tableColumns`

An array of table columns that should be in the image.

`dragEvent`

The event that initiated the drag.

`dragImageOffset`

An in/out parameter specifying the offset of the cursor in the image, the default value is <doc://com.apple.documentation/documentation/Foundation/NSZeroPoint>. Returning <doc://com.apple.documentation/documentation/Foundation/NSZeroPoint> causes the cursor to be centered.

## Return Value

An `NSImage` containing a custom image for the specified rows and columns participating in the drag.

---

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)