• 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
Accessing structure member NSDate in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Accessing structure member NSDate in NSTableView


  • Subject: Accessing structure member NSDate in NSTableView
  • From: Gilles Celli <email@hidden>
  • Date: Thu, 9 Nov 2006 17:59:24 +0100

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Accessing structure member NSDate in NSTableView
      • From: KJ Walker <email@hidden>
    • Re: Accessing structure member NSDate in NSTableView
      • From: Scott Stevenson <email@hidden>
    • Re: Accessing structure member NSDate in NSTableView
      • From: Stephane <email@hidden>
  • Prev by Date: Re: fork, pipes, and Tiger
  • Next by Date: Re: Creating an NSTimer subclass
  • Previous by thread: Re: fork, pipes, and Tiger
  • Next by thread: Re: Accessing structure member NSDate in NSTableView
  • Index(es):
    • Date
    • Thread