Skip to content

Commit

Permalink
column width
Browse files Browse the repository at this point in the history
  • Loading branch information
cescofry committed Jul 11, 2013
1 parent 3f3f475 commit 02cb92e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions HiperStrings/Controllers/ZFFileDetailController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

#import "ZFFileDetailController.h"

#define KEY_KEY @"Keys"
#define KEY_KEY @"Keys"
#define MIN_COLUMN_WIDTH 100

@interface ZFFileDetailController ()

Expand All @@ -30,6 +31,7 @@ - (void)setLangFile:(ZFTranslationFile *)langFile {

NSMutableArray *addCol = [self.columns mutableCopy];
NSArray *columns = [self.tableView.tableColumns copy];
float width = ceil(self.tableView.bounds.size.width / addCol.count);
[columns enumerateObjectsUsingBlock:^(NSTableColumn *column, NSUInteger idx, BOOL *stop) {
if ([self.columns containsObject:column.identifier]) {
[addCol removeObject:column.identifier];
Expand All @@ -42,6 +44,8 @@ - (void)setLangFile:(ZFTranslationFile *)langFile {
NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:obj];
[[column headerCell] setStringValue:obj];
[[column headerCell] setAlignment:NSLeftTextAlignment];
[column setWidth:width];
[column setMinWidth:MIN_COLUMN_WIDTH];
[self.tableView addTableColumn:column];
}];

Expand Down Expand Up @@ -75,7 +79,8 @@ - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColum
NSArray *translation = [self.langFile translationsByType:(self.segmentedControl.selectedSegment == 0)? ZFLangTypeIOS : ZFLangTypeAndorid andLanguageIdentifier:tableColumn.identifier];
ZFLangFile *lang = [translation lastObject];
ZFTranslationLine *line = [lang lineForKey:key];
return (line.type != ZFTranslationLineTypeUntranslated)? line.value : @"--";
NSString *value = (line.type != ZFTranslationLineTypeUntranslated && line.value.length > 0)? line.value : @"--";
return value;
}

//return [[self.rows objectForKey:tableColumn.identifier] objectForKey:[self.keys objectAtIndex:row]];
Expand Down

0 comments on commit 02cb92e

Please sign in to comment.