<!--
{
  "availability" : [
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextTable/drawBackground(for:withFrame:in:characterRange:layoutManager:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTextTable(im)drawBackgroundForBlock:withFrame:inView:characterRange:layoutManager:"
  },
  "title" : "drawBackground(for:withFrame:in:characterRange:layoutManager:)"
}
-->

# drawBackground(for:withFrame:in:characterRange:layoutManager:)

Draws any colors and other decorations for a text table block.

```
func drawBackground(for block: NSTextTableBlock, withFrame frameRect: NSRect, in controlView: NSView, characterRange charRange: NSRange, layoutManager: NSLayoutManager)
```

## Parameters

`block`

The text table block that wants to draw its background.

`frameRect`

The area in which drawing occurs.

`controlView`

The view controlling the drawing.

`charRange`

The range of the characters whose glyphs are to be drawn.

`layoutManager`

The layout manager controlling the typesetting.

## Discussion

This methods is called by the text table block `block` to draw any colors and other decorations before the text is drawn.

---

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)