Skip to content

Commit 4ae2c7c

Browse files
committed
Fix compatibility with macOS 10.8 #14
[NSTableColumn setTitle:] is only available on 10.10 or later
1 parent be2a2d0 commit 4ae2c7c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Table Tool/Document.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ -(NSData*)dataWithCSVConfig:(CSVConfiguration*)config error:(NSError**)outError
135135
[headerRow addObject:@""];
136136
}
137137
for(NSTableColumn * col in self.tableView.tableColumns){
138-
[headerRow replaceObjectAtIndex:col.identifier.integerValue withObject:col.title];
138+
[headerRow replaceObjectAtIndex:col.identifier.integerValue withObject:col.headerCell.stringValue];
139139
}
140140
exportData = [@[headerRow] arrayByAddingObjectsFromArray:exportData];
141141
}
@@ -568,7 +568,7 @@ -(void)updateTableColumns {
568568
for(int i = 0; i < _maxColumnNumber; ++i) {
569569
NSTableColumn *tableColumn = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithFormat:@"%d",i]];
570570
tableColumn.dataCell = dataCell;
571-
tableColumn.title = i < columnNames.count ? columnNames[i] : [self generateColumnName:i];
571+
tableColumn.headerCell.stringValue = i < columnNames.count ? columnNames[i] : [self generateColumnName:i];
572572
((NSCell *)tableColumn.headerCell).alignment = NSCenterTextAlignment;
573573
[self.tableView addTableColumn: tableColumn];
574574
}
@@ -578,7 +578,7 @@ -(void)updateTableColumnsNames {
578578
if(!self.csvConfig.firstRowAsHeader){
579579
for(int i = 0; i < [self.tableView.tableColumns count]; i++) {
580580
NSTableColumn *tableColumn = self.tableView.tableColumns[i];
581-
tableColumn.title = [self generateColumnName:i];
581+
tableColumn.headerCell.stringValue = [self generateColumnName:i];
582582
((NSCell *)tableColumn.headerCell).alignment = NSCenterTextAlignment;
583583
}
584584
}
@@ -850,7 +850,7 @@ -(void)addColumnAtIndex:(long) columnIndex {
850850
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithFormat:@"%ld",columnIdentifier]];
851851
col.dataCell = dataCell;
852852
[self.tableView addTableColumn:col];
853-
col.title = @"";
853+
col.headerCell.stringValue = @"";
854854
[self.tableView moveColumn:[self.tableView numberOfColumns]-1 toColumn:columnIndex];
855855

856856
for(NSMutableArray *rowArray in _data) {
@@ -901,7 +901,7 @@ -(void)restoreColumns:(NSMutableArray *)columnIds atIndexes:(NSIndexSet *)column
901901
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:columnIds[i]];
902902
col.dataCell = dataCell;
903903
if(self.csvConfig.firstRowAsHeader){
904-
col.title = [columnNames objectAtIndex:((NSString *)columnIds[i]).integerValue];
904+
col.headerCell.stringValue = [columnNames objectAtIndex:((NSString *)columnIds[i]).integerValue];
905905
}
906906
((NSCell *)col.headerCell).alignment = NSCenterTextAlignment;
907907
[self.tableView addTableColumn:col];

0 commit comments

Comments
 (0)