Contents

insertRow(_:)

Inserts a new row of cells before the specified row.

Declaration

func insertRow(_ row: Int)

Parameters

  • row:

    The location at which to insert the new row. If this is greater than the number of rows in the receiver, enough rows are created to expand the receiver to be row rows high.

Discussion

New cells are created if needed with makeCell(atRow:column:). 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.

If the number of rows or columns in the receiver has been changed with renewRows(_:columns:), then new cells are created only if they’re needed. This fact allows you to grow and shrink an NSMatrix without repeatedly creating and freeing the cells.

See Also

Laying Out the Cells of the Matrix