i have a outline view with a custom cell. all works fine but i need to know, if a button was pressed, in which row number the that button is.
how can i get this row number ?
i have a outline view with a custom cell. all works fine but i need to know, if a button was pressed, in which row number the that button is.
how can i get this row number ?
You could wire up your button's action to an IBAction
in your view controller (or whatever knows about the outline view) and call row(for:)
on the outline view:
@IBAction func buttonClicked(_ sender: NSButton) {
print("button row:", outlineView.row(for: sender))
}
Straight from the docs:
This method is typically called in the action method for an NSButton (or NSControl) to find out what row (and column) the action should be performed on.