Is there any way to merge cell's in a NSTableView?
I know there are two modes for displaying data in a NSTableView: cell-based and view-based. If the data are presented by cells, the function
tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int)
is responsable, otherwise
tableView(_ tableView: NSTableView, rowViewForRow row: Int)
Currently I'm using the first one. In iOS, you can use the cell prototype in interface builder to link the views with a custom UITableViewCell, but how can I achieve this for a complete row in a NSTableView?
tableView(_:viewFor:row:)
is a view based table view method. "This method is required if you want to use NSView objects instead of NSCell objects for the cells within a table view." – WillekeNSButton
has aNSButtonCell
object that actually does the drawing. If you want to "merge" the cells of a row and use a single view to draw the entire row, you need to implement- [NSTableViewDelegate tableView:rowViewForRow:]
. That method gets called first, and if it returns a view, that view is used for the entire row. – James Bucanek