• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Short Date Format for NSCalendarDate in bound NSTableColumn
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Short Date Format for NSCalendarDate in bound NSTableColumn (From: Jonathan Fewtrell <email@hidden>)
 >Re: Short Date Format for NSCalendarDate in bound NSTableColumn (From: glenn andreas <email@hidden>)

  • Prev by Date: NSView and focus
  • Next by Date: Re: lockFocus clearing current color
  • Previous by thread: Re: Short Date Format for NSCalendarDate in bound NSTableColumn
  • Next by thread: lockFocus clearing current color
  • Index(es):
    • Date
    • Thread