<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTableView/drawGrid(inClipRect:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTableView(im)drawGridInClipRect:"
  },
  "title" : "drawGrid(inClipRect:)"
}
-->

# drawGrid(inClipRect:)

Draws the grid lines within the supplied rectangle.

```
func drawGrid(inClipRect clipRect: NSRect)
```

## Parameters

`clipRect`

The rectangle in the table view’s coordinate system.

## Discussion

Draws the grid lines within `clipRect`, using the grid color set with [`gridColor`](/documentation/AppKit/NSTableView/gridColor).

Subclasses can override this method to draw grid lines other than the standard ones. This method draws a grid regardless of whether the table view is set to draw one automatically.

## See Also

[`intercellSpacing`](/documentation/AppKit/NSTableView/intercellSpacing)

The horizontal and vertical spacing between cells.

[`gridColor`](/documentation/AppKit/NSTableView/gridColor)

The color used to draw grid lines.



---

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)