问题命名NSTableColumn
-
22-09-2019 - |
题
我试图用一个空字符串作为标识符创建列,但可可似乎替换为空字符串字“场”每次我试图创建列时间。你怎么去解决这个?
- (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:@""];
不隶属于 StackOverflow