Instance Method

addColumn()

Adds a new column of cells to the right of the last column.

Declaration

func addColumn()

Discussion

This method raises an NSRangeException if there are 0 rows or 0 columns. This method creates new cells as needed with makeCell(atRow:column:). Use renewRows(_:columns:) to add new cells to an empty matrix.

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

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

func addColumn(with: [NSCell])

Adds a new column of cells to the right of the last column, using the given cells.

func addRow()

Adds a new row of cells below the last row.

func addRow(with: [NSCell])

Adds a new row of cells below the last row, using the specified cells.

func cellFrame(atRow: Int, column: Int) -> NSRect

Returns the frame rectangle of the cell that would be drawn at the specified location.

var cellSize: NSSize

The size of each cell in the matrix.

func insertColumn(Int)

Inserts a new column of cells at the specified location. .

func insertColumn(Int, with: [NSCell]?)

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

func insertRow(Int)

Inserts a new row of cells before the specified row.

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

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

var intercellSpacing: NSSize

The vertical and horizontal spacing between cells in the matrix.

func makeCell(atRow: Int, column: Int) -> NSCell

Creates a new cell at the location specified by the given row and column in the receiver.

var numberOfColumns: Int

The number of columns in the matrix.

var numberOfRows: Int

The number of rows in the matrix.

func putCell(NSCell, atRow: Int, column: Int)

Replaces the cell at the specified row and column with the new cell.

func removeColumn(Int)

Removes the specified column at from the receiver.

func removeRow(Int)

Removes the specified row from the receiver.

func renewRows(Int, columns: Int)

Changes the number of rows and columns in the receiver.

func sort(using: (Any, Any, UnsafeMutableRawPointer?) -> Int, context: UnsafeMutableRawPointer?)

Sorts the receiver’s cells in ascending order as defined by the specified comparison function.

func sort(using: Selector)

Sorts the receiver’s cells in ascending order as defined by the comparison method.