---
title: "dragImageForRows(with:tableColumns:event:offset:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableview/dragimageforrows(with:tablecolumns:event:offset:)"
---

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

Computes and returns an image to use for dragging.

## Declaration

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

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

## See Also

### Dragging

- [canDragRows(with:at:)](appkit/nstableview/candragrows(with:at:).md)
- [setDraggingSourceOperationMask(_:forLocal:)](appkit/nstableview/setdraggingsourceoperationmask(_:forlocal:).md)
- [verticalMotionCanBeginDrag](appkit/nstableview/verticalmotioncanbegindrag.md)
- [draggingDestinationFeedbackStyle](appkit/nstableview/draggingdestinationfeedbackstyle-swift.property.md)
- [setDropRow(_:dropOperation:)](appkit/nstableview/setdroprow(_:dropoperation:).md)
