我想在双击表头(显示调整大小光标)时将表列自动调整为其内容宽度,就像在 iTunes 上一样。
有人知道怎么做吗?
提前致谢
我想在双击表头(显示调整大小光标)时将表列自动调整为其内容宽度,就像在 iTunes 上一样。
有人知道怎么做吗?
提前致谢
Look at the NSTableView
method setDoubleAction:
. You can probably set it up from Interface Builder, too - I didn't check. From the documentation:
setDoubleAction:
Sets the message sent to the target when the user double-clicks an uneditable cell or a column header to a given selector.
- (void)setDoubleAction:(SEL)aSelector
Parameters
aSelector
The message the receiver sends to its target when the user double-clicks an uneditable cell or a column header.Discussion
If the double-clicked cell is editable, this message isn’t sent and the cell is edited instead. You can use this method to implement features such as sorting records according to the column that was double-clicked. See alsoclickedRow
which you can use to determine if a row was clicked rather than the column heading.For the method to have any effect, the receiver’s action and target must be set to the class in which the selector is declared. See Action Messages for additional information on action messages.