Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > NSDate in an NSTableView

NSDate in an NSTableView
Thread Tools
aaxin
Guest
Status:
Reply With Quote
Dec 11, 2000, 04:36 PM
 

I am having a difficult time getting an NSCalendarDate to show up in my NSTableView.
the third column of the tableview is the date column, and I am fairly certain I have the NSDateFormmater applied to that column correctly. In IB I dragged the NSDateFormatter from the palette to the third column header of the table view. when I test the Interface, it beeps at me when I thry to put a "jklk" in but when I enter a number, a date (1/1/01) or "today" it accepts that.

the code i am using to pass info to the tableview is below.
The line that causes the program to crash is

else if ([ident isEqual:I_DATE])
--> return [[taskListMArray objectAtIndex:row] dueDate];

I was under the impression that if you pass an NSCalendarDate pointer (dueDate) to the tableview and the cells have the date formatter it should just display the date in the format you set in IB.

dueDate is defined in a header as:
task.h:
NSCalendarDate *dueDate;
and the method is simple:
task.h:
- (NSCalendarDate *)dueDate;
task.m:
- (NSCalendarDate *)dueDate
{
return dueDate;
}

Any obvious or not so obvious mistakes that an NS, OSX, Obj-C newbie is making here?
is the problem most likely with the objectValueForTableColumn: function or the way I have imp'd dueDate?

All help is appreciated!

Kai

- (id)tableViewNSTableView *)tv
objectValueForTableColumnNSTableColumn *)tc
rowint)row
{
unsigned int prior;


NSString *ident = [tc identifier];



prior = [[taskListMArray objectAtIndex:row]priority];

if (tv == taskTableView)
{
if ([ident isEqual:I_DONE])
return [NSNumber numberWithInt:[[taskListMArray objectAtIndex:row] done]];
else if ([ident isEqual:I_DATE])
return [[taskListMArray objectAtIndex:row] dueDate];
else if ([ident isEqual:I_PRIORITY])
{
if (prior == 3)
return @"High";
if (prior == 2)
return @"Normal";
if (prior == 1)
return @"Low";
}
else if ([ident isEqual:I_SHORTDESC])
return [[taskListMArray objectAtIndex:row]shortDesc];
}
return @"";
}
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2