Re: NSTableView issues?
Re: NSTableView issues?
- Subject: Re: NSTableView issues?
- From: Neal Parikh <email@hidden>
- Date: Sun, 25 Aug 2002 00:33:52 -0400
I am using IB to set the identifiers, and they are what they say they
are. And that part is working, because the conditionals where I'm
checking for the value of identifier are going through properly because
it does execute the NSLog()s inside.
So I'm rather confused. :-)
- Neal
On Saturday, August 24, 2002, at 11:33 PM, Carlos Weber wrote:
On Saturday, Aug 24, 2002, at 12:32 Pacific/Honolulu, Neal Parikh
wrote:
Hi,
I'm writing Cocoa for the first time, and I'm running into some
trouble with my NSTableView. This is how I've set stuff up:
- there's a "Refresh" button which is connected to an AppController
- the AppController's outlet is the NSTableView
- the NSTableView (named mainTable in my code) has two columns, and
i've set identifiers for both
- I'm filling two arrays with various data (which works correctly; I
checked with NSLog()), and I want mainTable to use one for column #1,
the other for column #2
So what I've done in the '(id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex' method (which I've implemented in my AppController
class) is the following:
/* *** */
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn*)aTableColumn
row:(int)rowIndex
{
NSString *identifier = [aTableColumn identifier];
if ([identifier isEqualToString:@"userLogin"]) {
NSLog(@"userLoginArray = %@", [userLoginArray
objectAtIndex:rowIndex]);
return [userLoginArray objectAtIndex:rowIndex];
}
else if ([identifier isEqualToString:@"userName"]) {
NSLog(@"userNameArray = %@", [userNameArray
objectAtIndex:rowIndex]);
return [userNameArray objectAtIndex:rowIndex];
}
}
/* *** */
Now, the first column (userName) gets filled properly and works fine,
and I can see when I scroll up and down that those two NSLog()
statements are both getting executed in alternating order, which
seems correct. But the second column (identifier "userLogin") simply
will not display my data (stored in 'userLoginArray'). My current
idea is that my mistake is somewhere in the above method, but I'm not
sure. I've spent a fair bit of time going through the NSTableView
documentation, but that hasn't really helped with this bug.
Any ideas, tips, links, clues, etc would be greatly appreciated. =)
Thanks in advance.
When I've had this kind of inexplicable bug it has usually been a
problem with my nib. If you are setting the table column identifiers
in IB via the Info Panel, doublecheck to make sure they are set the
way you think they are. If you are not using IB to set the
identifiers, how are you doing it?
--
Neal Parikh <email@hidden>
"Few mortals realize how many other advantages follow from being free
from scruples and ready to venture anything." (Erasmus)
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.