Sped up table view creation to reuse date formatter

This commit is contained in:
michael starke
2013-11-16 00:02:54 +01:00
parent c4a4996082
commit eeb440fa1c
3 changed files with 38 additions and 7 deletions

View File

@@ -0,0 +1,13 @@
//
// MPAutotypeCommand.h
// MacPass
//
// Created by Michael Starke on 10/11/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MPAutotypeCommand : NSObject
@end

View File

@@ -0,0 +1,13 @@
//
// MPAutotypeCommand.m
// MacPass
//
// Created by Michael Starke on 10/11/13.
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
//
#import "MPAutotypeCommand.h"
@implementation MPAutotypeCommand
@end

View File

@@ -249,9 +249,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
}
if(isModifedColumn) {
if(![[view textField] formatter]) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
/* Just use one formatter instance since it's expensive to create */
static NSDateFormatter *formatter = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
formatter = [[NSDateFormatter alloc] init];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterMediumStyle];
});
[textField setFormatter:formatter];
}
[textField bind:NSValueBinding toObject:entry.timeInfo withKeyPath:@"lastModificationTime" options:nil];