<!--
{
  "availability" : [
    "macOS: 10.11.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextAttachmentContainer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextAttachmentContainer"
  },
  "title" : "NSTextAttachmentContainer"
}
-->

# NSTextAttachmentContainer

A set of methods that defines the interface to text attachment objects from a layout manager.

```
protocol NSTextAttachmentContainer : NSObjectProtocol
```

## Topics

### Getting the bounds

[`attachmentBounds(for:proposedLineFragment:glyphPosition:characterIndex:)`](/documentation/AppKit/NSTextAttachmentContainer/attachmentBounds(for:proposedLineFragment:glyphPosition:characterIndex:))

Returns the layout bounds of the text attachment to the layout manager.

### Getting the image

[`image(forBounds:textContainer:characterIndex:)`](/documentation/AppKit/NSTextAttachmentContainer/image(forBounds:textContainer:characterIndex:))

Returns the image object that the layout manager renders in the specified image bounds rectangle inside the text container.



---

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)