From 4ae2c7c7d981870a82a9e67c61acf1e70280a8e2 Mon Sep 17 00:00:00 2001 From: Jakob Egger Date: Sun, 30 Jul 2017 08:32:19 +0200 Subject: [PATCH] Fix compatibility with macOS 10.8 #14 [NSTableColumn setTitle:] is only available on 10.10 or later --- Table Tool/Document.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Table Tool/Document.m b/Table Tool/Document.m index 89393fb..bbc7a46 100644 --- a/Table Tool/Document.m +++ b/Table Tool/Document.m @@ -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]; } @@ -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]; } @@ -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; } } @@ -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) { @@ -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];