In iTunes, you will see that the first two columns (the first narrow one containing nothing) and the second one containing song name, are not movable. The others are movable.
How can I accomplish this with an NSTableView?
In iTunes, you will see that the first two columns (the first narrow one containing nothing) and the second one containing song name, are not movable. The others are movable.
How can I accomplish this with an NSTableView?
Implement the NSTableViewDelegate
method tableView:shouldReorderColumn:toColumn:
to control this behaviour. From the documentation:
When a column is initially dragged by the user, the delegate is first called with a newColumnIndex value of
-1
. ReturningNO
will disallow that column from being reordered at all. ReturningYES
allows it to be reordered, and the delegate will be called again when the column reaches a new location.
In your table view's delegate, respond to the tableView:shouldReorderColumn:toColumn:
message. See the documentation at that link for exactly what your implementation must do.