Skip to content

Commit

Permalink
Fix compatibility with macOS 10.8 #14
Browse files Browse the repository at this point in the history
[NSTableColumn setTitle:] is only available on 10.10 or later
  • Loading branch information
jakob committed Jul 30, 2017
1 parent be2a2d0 commit 4ae2c7c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Table Tool/Document.m
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ -(NSData*)dataWithCSVConfig:(CSVConfiguration*)config error:(NSError**)outError
[headerRow addObject:@""];
}
for(NSTableColumn * col in self.tableView.tableColumns){
[headerRow replaceObjectAtIndex:col.identifier.integerValue withObject:col.title];
[headerRow replaceObjectAtIndex:col.identifier.integerValue withObject:col.headerCell.stringValue];
}
exportData = [@[headerRow] arrayByAddingObjectsFromArray:exportData];
}
Expand Down Expand Up @@ -568,7 +568,7 @@ -(void)updateTableColumns {
for(int i = 0; i < _maxColumnNumber; ++i) {
NSTableColumn *tableColumn = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithFormat:@"%d",i]];
tableColumn.dataCell = dataCell;
tableColumn.title = i < columnNames.count ? columnNames[i] : [self generateColumnName:i];
tableColumn.headerCell.stringValue = i < columnNames.count ? columnNames[i] : [self generateColumnName:i];
((NSCell *)tableColumn.headerCell).alignment = NSCenterTextAlignment;
[self.tableView addTableColumn: tableColumn];
}
Expand All @@ -578,7 +578,7 @@ -(void)updateTableColumnsNames {
if(!self.csvConfig.firstRowAsHeader){
for(int i = 0; i < [self.tableView.tableColumns count]; i++) {
NSTableColumn *tableColumn = self.tableView.tableColumns[i];
tableColumn.title = [self generateColumnName:i];
tableColumn.headerCell.stringValue = [self generateColumnName:i];
((NSCell *)tableColumn.headerCell).alignment = NSCenterTextAlignment;
}
}
Expand Down Expand Up @@ -850,7 +850,7 @@ -(void)addColumnAtIndex:(long) columnIndex {
NSTableColumn *col = [[NSTableColumn alloc] initWithIdentifier:[NSString stringWithFormat:@"%ld",columnIdentifier]];
col.dataCell = dataCell;
[self.tableView addTableColumn:col];
col.title = @"";
col.headerCell.stringValue = @"";
[self.tableView moveColumn:[self.tableView numberOfColumns]-1 toColumn:columnIndex];

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

0 comments on commit 4ae2c7c

Please sign in to comment.