Re: Short Date Format for NSCalendarDate in bound NSTableColumn
Re: Short Date Format for NSCalendarDate in bound NSTableColumn
- Subject: Re: Short Date Format for NSCalendarDate in bound NSTableColumn
- From: Jonathan Fewtrell <email@hidden>
- Date: Sat, 16 Apr 2005 18:59:33 +0100
On 16 Apr 2005, at 17:17, glenn andreas wrote:
you could write your own NSDateFormatter subclass instead (and then use that). Something roughly like:
@interface ShortDateFormatter: NSDateFormatter
@end
@implementation ShortDateFormatter
- (NSString *) dateFormat
{
return [[NSUserDefaults standardUserDefaults] stringForKey: NSShortDateFormatString];
}
@end
As a follow-up to this, I found that overriding -dateFormat doesn't work. It still picks up the format from the tokens in IB. I found I needed to override -initWithDateFormat instead:
- (id)initWithDateFormat:(NSString *)format allowNaturalLanguage:(BOOL)flag
{
NSString *formatJF;
formatJF = [[NSUserDefaults standardUserDefaults] stringForKey: NSShortDateFormatString];
self = [super initWithDateFormat:formatJF allowNaturalLanguage:flag];
return self;
}
Not really sure why this should be, but the docs do actually say "
You must specify a format string whenever you create a date formatter". _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden