---
title: "renewRows(_:columns:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmatrix/renewrows(_:columns:)"
---

# renewRows(_:columns:)

Changes the number of rows and columns in the receiver.

## Declaration

```swift
func renewRows(_ newRows: Int, columns newCols: Int)
```

## Parameters

- `newRows`: The new number of rows in the matrix.
- `newCols`: The new number of columns in the matrix.

## Discussion

Discussion This method uses the same cells as before, creating new cells only if the new size is larger; it never frees cells. It doesn’t redisplay the receiver. Your code should normally send sizeToCells() after invoking this method to resize the receiver so it fits the changed cell arrangement. This method deselects all cells in the receiver.

## See Also

### Laying Out the Cells of the Matrix

- [addColumn()](appkit/nsmatrix/addcolumn().md)
- [addColumn(with:)](appkit/nsmatrix/addcolumn(with:).md)
- [addRow()](appkit/nsmatrix/addrow().md)
- [addRow(with:)](appkit/nsmatrix/addrow(with:).md)
- [cellFrame(atRow:column:)](appkit/nsmatrix/cellframe(atrow:column:).md)
- [cellSize](appkit/nsmatrix/cellsize.md)
- [getNumberOfRows(_:columns:)](appkit/nsmatrix/getnumberofrows(_:columns:).md)
- [insertColumn(_:)](appkit/nsmatrix/insertcolumn(_:).md)
- [insertColumn(_:with:)](appkit/nsmatrix/insertcolumn(_:with:).md)
- [insertRow(_:)](appkit/nsmatrix/insertrow(_:).md)
- [insertRow(_:with:)](appkit/nsmatrix/insertrow(_:with:).md)
- [intercellSpacing](appkit/nsmatrix/intercellspacing.md)
- [makeCell(atRow:column:)](appkit/nsmatrix/makecell(atrow:column:).md)
- [numberOfColumns](appkit/nsmatrix/numberofcolumns.md)
- [numberOfRows](appkit/nsmatrix/numberofrows.md)
