Instance Method

tableView:shouldReorderColumn:toColumn:

Asks the delegate to allow or prohibit the specified column to be dragged to a new location.

Declaration

- (BOOL)tableView:(NSTableView *)tableView shouldReorderColumn:(NSInteger)columnIndex toColumn:(NSInteger)newColumnIndex;

Parameters

tableView

The table view that sent the message.

columnIndex

The index of the column being dragged.

newColumnIndex

The proposed target index of the column.

Return Value

YES if the column reordering should be allowed, otherwise NO.

Discussion

When a column is initially dragged by the user, the delegate is first called with a newColumnIndex value of -1. Returning NO will disallow that column from being reordered at all. Returning YES allows it to be reordered, and the delegate will be called again when the column reaches a new location.

The actual NSTableColumn instance can be retrieved from the tableColumns array.

If this method isn’t implemented, all columns are considered reorderable.

See Also

Moving and Resizing Columns

- tableView:didDragTableColumn:

Tells the delegate that the specified table column was dragged.

- tableViewColumnDidMove:

Tells the delegate that a table column was moved by user action.

- tableViewColumnDidResize:

Tells the delegate that a table column was resized.