<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextAttachmentCellProtocol/draw(withFrame:in:characterIndex:layoutManager:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextAttachmentCell(im)drawWithFrame:inView:characterIndex:layoutManager:"
  },
  "title" : "draw(withFrame:in:characterIndex:layoutManager:)"
}
-->

# draw(withFrame:in:characterIndex:layoutManager:)

Draws the cell’s image using the specified layout manager.

```
@MainActor func draw(withFrame cellFrame: NSRect, in controlView: NSView?, characterIndex charIndex: Int, layoutManager: NSLayoutManager)
```

## Parameters

`cellFrame`

The frame rectangle in which to draw.

`controlView`

The view in which to draw.

`charIndex`

The index of the attachment character within the text.

`layoutManager`

The layout manager for the text.

## Discussion

---

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)