NSTableView - NSButtonCell datasource type?

I have a table with checkbox style cells and I cannot figure out how to get these buttons to use the headers they should be using. Does the data source have to be an array of strings? Array of dictionaries (string / boolean)? An array of NSButtonCells? None of them work = /

0


source to share


1 answer


NSButtonCell uses integer values ​​as data source (like NSNumbers):

NSMixedState = -1,
NSOffState   = 0,
NSOnState    = 1

      



It won't help you with the title, of course you have to set this separately. If you are using bindings, NSButtonCell defines a binding title

that 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.

+3


source







All Articles