Andy
Andy

Reputation: 30418

Getting the row of a NSButtonCell

I have a NSTableView that contains a NSButtonCell in one of the columns. I can set up the action that is called when the button is clicked in Interface Builder fine, but I can't find anyway to determine which row in the table that the button exists in. Is there any way to do this?

Thanks. :)

Upvotes: 2

Views: 946

Answers (1)

Ashley Clark
Ashley Clark

Reputation: 8823

The cell for a particular column is reused throughout the whole table so there isn't one cell per row by default. You can get the the row that was clicked on though in your action method by sending the clickedRow message to the cell's table view.

NSInteger clickedRowIndex = [tableView clickedRow];

Upvotes: 5

Related Questions