0

I have the NSTableView object, that consists from one column with NSButtonCell cell. Also I have the class, that implements the NSTableViewDataSource protocol. The method to set the cell value:

-( id )tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
    NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];
    [cell setTitle:@"Title" ];
    [cell setState:NSOnState];
    return cell;
}

In result the state of the button displayed properly but the title stays empty. How I can set the title of the button?

kaa
  • 1,265
  • 5
  • 22
  • 39
  • Just did a quick search on SO and found **[this](http://stackoverflow.com/questions/8077875/nsbuttoncell-of-check-type-within-nstableview-does-not-allow-to-have-value-chang)**. Maybe there is something there? – kgdesouz Jul 03 '13 at 23:30

1 Answers1

3

I solved this issue by replacing the

 NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];

to

NSButtonCell* cell = [tableColumn dataCell];
kaa
  • 1,265
  • 5
  • 22
  • 39