I've got a table with checkbox-style cells, and I can't figure out how to get these buttons to take on the titles that they're supposed to. Should the data source be an array of strings? An array of dictionaries (string/boolean)? An array of NSButtonCells? None of these seem to work =/
Macos – NSTableView – NSButtonCell Data Source type
cocoamacos
Best Answer
NSButtonCell uses integer values (as NSNumbers) as its data source:
That doesn't help you with the title of course, you have to set that separately. If you're using bindings, NSButtonCell defines a
title
binding you can bind to an array of strings. Otherwise, you can use the NSTableView delegate method- (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex
to set the title for each row.