How can I get a nstableview to send an action when the user double-clicks an editable cell
I am trying to emulate the behavior found in finder and itunes. Single click on a selected object edits it. Double click opens the object.
I have set the doubleAction of the tableView but like it says in the documentation. "If the double-clicked cell is editable, this message isn’t sent and the cell is edited instead." I dont want this. Is there a way i can get that message sent even if the cell is editable? I really 开发者_如何学Chave no idea how to begin implementing this. Any general pointers would be appreciated.
A quick thought comes to mind... turn off editing for all cells. This way a double-click will always call your method. Then in the method do your double-click thing but also decide if the cell should be editable (and if so start editing the cell).
Did you have set the Action-target? In you ViewController you should have a:
[self.tableview setTarget:self];
[self.tableview setDoubleClickAction:@selector(mydoubleClick)];
-(void)mydoubleClick:(id)sender{
...
}
精彩评论