質問

私は識別子として空の文字列と列を作成しようとしているが、ココアは、単語「フィールド」私は列を作成しようとするたびと空の文字列を置き換えるようです。どのようにこの問題を回避行くのですか?

- (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];
}
役に立ちましたか?

解決

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

[[columnColumn headerCell] setStringValue:@""];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top