<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSCell/draggingImageComponents(withFrame:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSCell(im)draggingImageComponentsWithFrame:inView:"
  },
  "title" : "draggingImageComponents(withFrame:in:)"
}
-->

# draggingImageComponents(withFrame:in:)

Generates dragging image components with the specified frame in the view.

```
func draggingImageComponents(withFrame frame: NSRect, in view: NSView) -> [NSDraggingImageComponent]
```

## Parameters

`frame`

The bounding rectangle of the receiver.

`view`

The view that manages the cell.

## Return Value

An array of [`NSDraggingImageComponent`](/documentation/AppKit/NSDraggingImageComponent) objects representing the cell.

## Discussion

The default implementation generates an image from the cell and return two components: one for [`label`](/documentation/AppKit/NSDraggingItem/ImageComponentKey/label) and another for [`icon`](/documentation/AppKit/NSDraggingItem/ImageComponentKey/icon). This is done by capturing the portion from the [`titleRect(forBounds:)`](/documentation/AppKit/NSCell/titleRect(forBounds:)) and [`imageRect(forBounds:)`](/documentation/AppKit/NSCell/imageRect(forBounds:)) methods respectively.

This method can be subclassed and overridden to provide a custom set of [`NSDraggingImageComponent`](/documentation/AppKit/NSDraggingImageComponent) to create the drag image for the cell. This method is generally used by NSTableView/NSOutlineView.

> Note:
> NSCell currently has an issue where it will return an empty array from `draggingImageComponentsWithFrame:inView:` if the cell does not have an image portion. To work around this, subclass NSCell and override `draggingImageComponentsWithFrame:inView:` and generate your own ``doc://com.apple.appkit/documentation/AppKit/NSDraggingImageComponent`` in the returned array.

---

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)