Cocoa NSTableView:NSButtonCell的标题有问题
我有一个NSTableView对象,它由一列和NSButtonCell单元格组成。 我还有一个类,它实现了NSTableViewDataSource协议。 设置单元格值的方法:Cocoa NSTableView:NSButtonCell的标题有问题,cocoa,nstableview,Cocoa,Nstableview,我有一个NSTableView对象,它由一列和NSButtonCell单元格组成。 我还有一个类,它实现了NSTableViewDataSource协议。 设置单元格值的方法: -( id )tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSButtonCell* cell = [[[NSButtonCell al
-( id )tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];
[cell setTitle:@"Title" ];
[cell setState:NSOnState];
return cell;
}
结果,按钮的状态正确显示,但标题保持为空。
如何设置按钮的标题?我通过替换
NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];
到
我通过替换
NSButtonCell* cell = [[[NSButtonCell alloc] init] autorelease];
到
只是在某处做了一个快速搜索,找到了。也许那里有什么?只是在某处做了一个快速搜索,然后找到了。也许那里有什么?