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: glenn andreas <email@hidden>
- Date: Sat, 16 Apr 2005 11:17:59 -0500
On Apr 16, 2005, at 11:06 AM, Jonathan Fewtrell wrote:
I have an array of model objects displayed in an NSTableView controlled via binding through an NSArrayController. One of the ivars of the model is of class NSCalendarDate and is bound to one of the NSTableColumns.
In basic form it displays OK, but the default date format is too long. Unfortunately the NSDateFormatter included in IB cannot handle the NSShortDateFormatString. There is no token for this (and I want the short format to be as set by the user in System Preferences, rather than imposing a format myself).
So I thought I'd write a ValueTransformer instead. Here's the code:
Not that this directly solves the problem you're seeing, but as an alternate approach 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
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
quadrium | build, mutate, evolve | images, textures, backgrounds, art
_______________________________________________
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