Question

Given an NSMatrix and an NSCell is there a quick way to query the matrix to know at which row and column in the matrix the cell is placed. I would like to know this upon receiving action messages from NSActionCells.

The only way I can see of doing it is to loop through the rows and columns of the matrix and check for equality with the message sender, or give tags to the cells based on their position, which is ugly. I'm sure there's a better way of doing this, isn't there?

Was it helpful?

OTHER TIPS

I think you should set a -tag value on the cells in question. The canonical example of this is the cells in a matrix of digits for a calculator app. Instead of trying to figure out where they are in the matrix, you can just check their tag to see what digit they represent.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top