Answer the question
In order to leave comments, you need to log in
How to determine the data for the table cell (NSTableView) in which the button was clicked?
How to determine the data for the table cell (NSTableView) in which the button was clicked? The (Int) tag is not suitable for these cases, as I work in tandem with the FetchResultController and the deletion / insertion animation. Accordingly, if you assign tag = row when deleting, the tags will not be recalculated taking into account the operation. Only when calling TableView.reloadData(). How can I bind to a cell / NSTextView exactly the value of the corresponding data from the DataSource?
Answer the question
In order to leave comments, you need to log in
If you are working with a FetchResultController, the data is taken from the Core Data table that is being fetched from, and each cell corresponds to the data in the FetchResultController with the corresponding IndexPath, which you can get in cellForRow atIndexPath and fill in the fields. So you don't have to tie anything. Read documentation, study examples.
Forget about tags(!!!) never use them, avoid them like pranks (...that's what they are).
If you insert a view into a cell after creating the cell, then set up the view in this cell into some kind of property by a weak reference by a delegate or something like that. And on pressing, take a cell from the property. Better not the cell itself, but the cell data that you need.
And, frankly, the task is described crumpled. For good, it is not clear and I answered what I understood from your description.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question