简体   繁体   English

双击后如何使NSTableCellView可编辑?

[英]How can I make a NSTableCellView editable after a doubleclick?

SETUP: 设定:

I created a NSTableView , which has a normal NSTableCellView , in Storyboard. 我在Storyboard中创建了一个具有正常NSTableCellViewNSTableView Now I click on the textfield within the NSTableCellView and select Editable as Behavior. 现在,我单击NSTableCellView内的文本字段,然后选择Editable作为Behavior。 Build & Launch. 生成并启动。

RESULT: 结果:

When you click on a cell, it becomes highlighted, if you then click on it again it will become editable. 当您单击一个单元格时,它会突出显示,如果再次单击它,它将变为可编辑状态。 You would assume that if you double clicked (first highlight, then edit) another cell that would go straight into editing mode, but this is not the case it will only highlight it. 您将假定如果双击(先突出显示然后进行编辑)另一个将直接进入编辑模式的单元格,但事实并非如此,它只会突出显示它。 Then I have to wait a short amount before I can click to edit. 然后,我必须等待一小段时间,然后才能单击编辑。

PREFERRED RESULT: 首选结果:

When I edit a cell and double click on another cell it should go straight into editing mode. 当我编辑一个单元格并双击另一个单元格时,它应该直接进入编辑模式。

[self.tableView setDoubleAction:@selector(doubleClick:)]; 
//...
- (void)doubleClick:(id)sender
{
   //set your cell to editable mode
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM