4

識別子として空の文字列を使用して列を作成しようとしていますが、列を作成しようとするたびに、Cocoaは空の文字列を「フィールド」という単語に置き換えているようです。これをどのように回避しますか?

- (void)addColumnWithCheckboxToTable:(NSTableView *)table
{
    // Add column with checkbox before all other columns
    // This column will have no title and should be as wide as the checkbox
    NSTableColumn *column = [[[NSTableColumn alloc] initWithIdentifier:@" "] autorelease];

    // The checkbox is to be initialised without a title
    NSButtonCell *checkbox = [[[NSButtonCell alloc] initTextCell:@" "] autorelease];
    [checkbox setEditable:YES];
    [checkbox setButtonType:NSSwitchButton];
    [checkbox setImagePosition:NSImageOnly];
    [checkbox setControlSize:NSSmallControlSize];

    // Add column with checkbox to table
    [column setDataCell:checkbox];

    // Add column to table
    [table addTableColumn:column];
}
4

1 に答える 1

10

列の識別子は、そのタイトルと同じものではありません。-headerCellの文字列値を設定します。

[[columnColumn headerCell] setStringValue:@""];
于 2010-01-25T18:14:48.907 に答える