mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-16 20:59:38 +00:00
Sped up table view creation to reuse date formatter
This commit is contained in:
13
MacPass/MPAutotypeCommand.h
Normal file
13
MacPass/MPAutotypeCommand.h
Normal 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
|
||||||
13
MacPass/MPAutotypeCommand.m
Normal file
13
MacPass/MPAutotypeCommand.m
Normal 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
|
||||||
@@ -249,9 +249,14 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
|
|||||||
}
|
}
|
||||||
if(isModifedColumn) {
|
if(isModifedColumn) {
|
||||||
if(![[view textField] formatter]) {
|
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 setDateStyle:NSDateFormatterMediumStyle];
|
||||||
[formatter setTimeStyle:NSDateFormatterMediumStyle];
|
[formatter setTimeStyle:NSDateFormatterMediumStyle];
|
||||||
|
});
|
||||||
[textField setFormatter:formatter];
|
[textField setFormatter:formatter];
|
||||||
}
|
}
|
||||||
[textField bind:NSValueBinding toObject:entry.timeInfo withKeyPath:@"lastModificationTime" options:nil];
|
[textField bind:NSValueBinding toObject:entry.timeInfo withKeyPath:@"lastModificationTime" options:nil];
|
||||||
|
|||||||
Reference in New Issue
Block a user