Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing structure member NSDate in NSTableView



Hello,

My problem: How to access the structure member NSDate *acqDate without copying it to a new structure ?
My code crashes NSTableView !!!



My KeithleyMultimeter class (for performance reason I don't want to use NSArray but structures instead, this was discussed here several weeks ago):


@interface KeithleyMultimeter : NSObject {

struct keithley_struct {
		
		NSDate *acqDate;
				
		double channel[MAX_NBR_OF_CHANNELS];

} k2700_data[MAX_ACQ_DATA_PER_DAY];

// KeithleyMultimeter Accessor method
-(struct keithley_struct *)k2700_data
{	
	return k2700_data;
}


Now in the AcquiController.m class:

-(id) init
{
	self= [super init];
	k2700 = [[KeithleyMultimeter alloc] init];
	return self;
}

....
....


- (id)tableView:(NSTableView *)tableView objectValueForTableColumn: (NSTableColumn *)Column row:(int)Row
{
int i=0;

struct keithley_struct *k2700_str;

//Copying to new structure, because [k2700 k2700_data[Row].acqDate doesn't work
k2700_str = [k2700 k2700_data];



// Display date and time
if ( [identifier isEqualToString:@"time"])
{
return [k2700_str[Row].acqDate description]; <= this crashes the app !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
}


else // display values
{
for (i=0 ; i <= NBR_OF_CHANNELS; i++)
if ( [identifier isEqualToString:[[NSNumber numberWithInt:(i+1)] stringValue]])
{
return [NSNumber numberWithDouble:k2700_str[Row].channel[i]]; // this works fine !!!!!!!!!!!!!
}
}


}

Its' mainly crashing when accessing the structure member NSDate....

Why ?

Thanks in  advance,

Gilles Celli

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.