开发者

Make only a few columns of an NSTableView movable

In iTunes, you will see that the first two columns (the first narrow one containing nothing) and the second 开发者_Python百科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. 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜