Reputation: 1147
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 =/
Upvotes: 0
Views: 1396
Reputation: 40515
NSButtonCell uses integer values (as NSNumbers) as its data source:
NSMixedState = -1,
NSOffState = 0,
NSOnState = 1
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.
Upvotes: 3