views:

20

answers:

2

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?

+3  A: 

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. 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.

Carl Norum
+1  A: 

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.

Peter Hosey