Contents

insertRow(_:with:)

Inserts a new row of cells before the specified row, using the given cells.

Declaration

func insertRow(_ row: Int, with newCells: [NSCell]?)

Parameters

  • row:

    The location at which to insert the new row.

  • newCells:

    An array of objects to use when filling the new row, starting with the object at index 0. Each object in newCells should be an instance of Nscell or one of its subclasses (usually Nsactioncell).

Discussion

If row is greater than the number of rows in the receiver, enough rows are created to expand the receiver to be row rows high. newCells should either be empty or contain a sufficient number of cells to fill each new row. If newCells is nil or an array with no elements, the call is equivalent to calling insertRow(_:). Extra cells are ignored, unless the matrix is empty. In that case, a matrix is created with one row and enough columns for all the elements of newCells.

This method redraws the receiver. Your code may need to send sizeToCells() after sending this method to resize the receiver to fit the newly added cells.

See Also

Laying Out the Cells of the Matrix