I set NSButtonCell
as a cell type in a Table Column
in my NSTableView
.
I implemented an IBAction
method, but I can't wire it with NSButtonCell
in IB - the wire don't want to highlight a button from NSTableView
.
How to connect a method with NSButtonCell
? Or maybe there'se another way to handle its click event?
Thanks
You should be able to wire up a connection from the cell by control+dragging to any object in your NIB. Just make sure the cell is actually selected, and that your action is defined as an IBAction
in the object's header file. In your action method you can determine which row was selected by calling [tableView clickedRow]
.
Edit: Here's a demonstration. Make sure you click at least four times on the check box to get it selected, hold down the control key and drag from the cell to your object.
来源:https://stackoverflow.com/questions/8522965/nsbuttoncell-in-nstableview-click-handling