• 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
DateFormatter in outlineview cell....(again sorry!)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DateFormatter in outlineview cell....(again sorry!)


  • Subject: DateFormatter in outlineview cell....(again sorry!)
  • From: Keith Pritchard <email@hidden>
  • Date: Tue, 1 Oct 2002 17:20:26 +0100

Hi,

I know its a bit of a repeat but something strange is going on.. still
just getting a blank cell whenever my formatter is applied (whether via
IB or programmatically).

I must be doing something really fundamentally wrong but don't know
what....
Thanks for any ideas.. even if its debug tips..... Keith

NSDateFormatter *formatter; (declared in .h)

- (void) awakeFromNib
{
formatter = [[NSDateFormatter alloc]
initWithDateFormat:@"%b %d %y" allowNaturalLanguage:YES];
}

Try and apply it to the date field of the outlineview....

- (void)outlineView:(NSOutlineView *)outlineView
willDisplayCell:(id)theCell forTableColumn:(NSTableColumn *)theColumn
item:(id)item
{
if ([[theColumn identifier] isEqualToString:@"dateField"]) //right
column??
[theCell setFormatter:formatter];
}



//Attempt to display an error if format fails... seems to never get
called

-(BOOL)control:(NSControl *)control didFailToFormatString:(NSString
*)string errorDescription:(NSString *)error
{
NSLog(@"oops formatting of %@ failed: %@,string",error);
return NO;

}


- (id)outlineView:(NSOutlineView *)outlineView
objectValueForTableColumn:(NSTableColumn *)col byItem:(id)item
{
if ([[col identifier] isEqualToString:@"numberField"]) return
[item objectForKey:@"subject"];
if ([[col identifier] isEqualToString:@"authorField"]) return
[item objectForKey:@"name"];
if ([[col identifier] isEqualToString:@"dateField"]) return
@"12/12/02"; //Just to test

}
_______________________________________________
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.

  • Follow-Ups:
    • Re: DateFormatter in outlineview cell....(again sorry!)
      • From: Keith Pritchard <email@hidden>
  • Prev by Date: Re: [newbie] Handling a preferences window
  • Next by Date: Re: Problem calling InternetConfig in Jaguar
  • Previous by thread: Re: Subclassing NSMutableAttributedString
  • Next by thread: Re: DateFormatter in outlineview cell....(again sorry!)
  • Index(es):
    • Date
    • Thread