Re: NSTableview datasource issues
Re: NSTableview datasource issues
- Subject: Re: NSTableview datasource issues
- From: Greg Guerin <email@hidden>
- Date: Sun, 20 Dec 2009 13:08:57 -0700
Yes, I set the breakpoint on the data source methods? The
datasource methods are not reached at all.
Then you must consider the possibility that your table view has a nil
data source, or a data source of a different class.
If the methods definitely aren't being called, then simple logic
suggests your problem lies somewhere other than that data-source
class. Perhaps in the creation or assignment of the data-source.
Perhaps in the creation or use of the table view. You'll have to
backtrack it to find out.
Another possibility is some kind of error or mismatch between your
source and your compiled code, where what's loaded and debugged isn't
what you have in your source. Doing a Clean build usually fixes such
errors.
-(id)tableView:(NSTableView *)aTableView
ObjectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
I'm pretty sure that's the wrong method name. Check the capitalization.
If your source code is correct, then it was probably mangled by
mailing. The list-archives post was also stripped of a lot of
necessary whitespace, so capital-mangling would not surprise me.
http://lists.apple.com/archives/cocoa-dev/2009/Dec/msg01215.html
-(IBAction)initializeSectorSegmentData:(id) sender
{
segmentDict=[[MyDocument getSectorSegmentData:(id) sender]
mutableCopy];
[segmentDict retain];
NSWindow *w =[segmentTableView window];
[w makeKeyWindow];
//Fill the table row by row;
int i=0;
NSMutableArray *aXtemp;
if ([segmentIndustryData count]>0) [segmentIndustryData
removeAllObjects];
[[segmentDataController content] removeAllObjects];
for (id key in segmentDict)
(Note: I have inserted spaces in the above based on what seems
reasonable. I may have guessed wrong.)
This code looks odd, especially considering you're also setting
segmentDict to an empty dictionary in the -init method. The
assignment to segmentDict in -init may be problematic, depending on
where else that global variable is used.
First, getSectorSegmentData appears to be a class method. That seems
unusual to me. It may be justified, but it still seems unusual.
Second, it's unclear whether the returned dict assigned to
segmentDict actually contains anything or not. If not, then the
'for' loop will get no keys, the loop body will never execute, and
self's ivars will contain no objects. If that happens, then the data-
source has a count of 0 and contains nothing.
A data-source which contains nothing differs from a data-source's
methods never being called or a data-source object being nil. The
visible effect may be similar, an empty table-view, but the execution
path is different.
-- GG
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden