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

# columnsInRect:

Returns a range of indexes for the table view’s columns that lie wholly or partially within the horizontal boundaries of the specified rectangle.

```
- (NSRange) columnsInRect:(NSRect) rect;
```

## Parameters

`rect`

A rectangle in the coordinate system of the table view.

## Return Value

A range of indexes for the table view’s columns that lie wholly or partially within the horizontal boundaries of `aRect`. If the width or height of `aRect` is `0`, returns an `NSRange` whose length is `0`.

## Discussion

The location of the range is the first such column’s index, and the length is the number of columns that lie in `aRect`.

## See Also

[`func rows(in: NSRect) -> NSRange`](/documentation/AppKit/NSTableView/rows(in:))

Returns a range of indexes for the rows that lie wholly or partially within the vertical boundaries of the specified rectangle.



---

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)