---
title: "columnsInRect:"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableview/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.

## Declaration

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

## Parameters

- `rect`: A rectangle in the coordinate system of the table view.

## Return Value

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

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

### Related Documentation

- [rows(in:)](appkit/nstableview/rows(in:).md)

### Deprecated Methods

- [dragImageForRows:event:dragImageOffset:](appkit/nstableview/dragimageforrows:event:dragimageoffset:.md)
- [setAutoresizesAllColumnsToFit:](appkit/nstableview/setautoresizesallcolumnstofit:.md)
- [autoresizesAllColumnsToFit](appkit/nstableview/autoresizesallcolumnstofit.md)
- [selectColumn:byExtendingSelection:](appkit/nstableview/selectcolumn:byextendingselection:.md)
- [selectRow:byExtendingSelection:](appkit/nstableview/selectrow:byextendingselection:.md)
- [tableView:writeRows:toPasteboard:](objectivec/nsobject-swift.class/tableview:writerows:topasteboard:.md)
- [setDrawsGrid:](appkit/nstableview/setdrawsgrid:.md)
- [drawsGrid](appkit/nstableview/drawsgrid.md)
- [selectedColumnEnumerator](appkit/nstableview/selectedcolumnenumerator.md)
- [selectedRowEnumerator](appkit/nstableview/selectedrowenumerator.md)
- [focusedColumn()](appkit/nstableview/focusedcolumn().md)
- [setFocusedColumn(_:)](appkit/nstableview/setfocusedcolumn(_:).md)
- [shouldFocusCell(_:atColumn:row:)](appkit/nstableview/shouldfocuscell(_:atcolumn:row:).md)
- [performClickOnCell(atColumn:row:)](appkit/nstableview/performclickoncell(atcolumn:row:).md)
- [preparedCell(atColumn:row:)](appkit/nstableview/preparedcell(atcolumn:row:).md)
