NSDateFormatter problems
NSDateFormatter problems
- Subject: NSDateFormatter problems
- From: Will Cosgrove <email@hidden>
- Date: Wed, 20 Nov 2002 16:47:17 -0600
Hi All,
I've having some major problems with NSDateFormatter and I was
wondering if anyone had some suggestions. I'm trying to get the
localized short date from NSUserDefaults, then set a formatter with it
and allow the formatted NSTableViewColumn cell to be editable. This is
the code I'm using:
NSString* formatString = [NSString stringWithString: [[NSUserDefaults
standardUserDefaults] objectForKey:NSShortDateFormatString]];
dateFormatter = [[NSDateFormatter alloc]
initWithDateFormat:formatString allowNaturalLanguage:NO];
//setting the table column's data cell formatter - which I know is
valid.
[[column dataCell] setFormatter: formatter];
(snip stuff)
[column setEditable: YES];
This works great to format the column's date to the localized value.
But after I set the cell's formatter I can't exit editing the cell
because the formatter ALWAYS fails when validating the date format. I
would imagine it thinks the format of the new value in the cell is
invalid, but it's not. However, if I set the formatter up with a
string like so:
dateFormatter = [[NSDateFormatter alloc] initWithDateFormat:@"%m/%d/%y"
allowNaturalLanguage:NO];
It works the way it should. Does anyone have any idea why this would
be failing, it's driving me crazy.
Thanks in advance.
Will C.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.