0
votes

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?

1
Just did a quick search on SO and found this. Maybe there is something there?kgdesouz

1 Answers

3
votes

I solved this issue by replacing the

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

to

NSButtonCell* cell = [tableColumn dataCell];