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

Re: Accessing structure member NSDate in NSTableView


  • Subject: Re: Accessing structure member NSDate in NSTableView
  • From: Scott Stevenson <email@hidden>
  • Date: Thu, 9 Nov 2006 12:26:31 -0800


On Nov 9, 2006, at 8:59 AM, Gilles Celli wrote:

// 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 !!!!!!!!!!!!!
}
}


It's just a guess, but I think the syntax might look odd to Objective-C.

Try something like:

	if ( [identifier isEqualToString:@"time"])
	{
		NSDate * myDate = k2700_str[Row].acqDate;
		return myDate;
	}

If that doesn't work, post the call strack of the crash to the list here. Also, make sure the NSDate object is properly retained.

One last thought. With all of the objects you're generating on the fly here (+numberWithDouble, +numberWithInt, +stringValue), I think you could be nullifying any minor performance games from not using NSArray.

You might want to just keep two copies of the array: one "source" C- style array, and one "target" NSArray. When one changes, you rebuild the other one. I think it would simplify all of your code here.


Best Regards,

   - Scott
_______________________________________________
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


References: 
 >Accessing structure member NSDate in NSTableView (From: Gilles Celli <email@hidden>)

  • Prev by Date: Re: fork, pipes, and Tiger
  • Next by Date: Re: Accessing structure member NSDate in NSTableView
  • Previous by thread: Re: Accessing structure member NSDate in NSTableView
  • Next by thread: Re: Accessing structure member NSDate in NSTableView
  • Index(es):
    • Date
    • Thread