سؤال

أحاول إنشاء عمود بسلسلة فارغة كمعرف ولكن يبدو أن الكاكاو يحل محل السلسلة الفارغة بكلمة "حقل" في كل مرة أحاول إنشاء العمود. كيف تتجول هذا؟

- (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