Question about TableView - how do I know which tableView?
Question about TableView - how do I know which tableView?
- Subject: Question about TableView - how do I know which tableView?
- From: Denis Stanton <email@hidden>
- Date: Thu, 6 Feb 2003 14:55:25 +1300
Hi
I hope someone can explain something about using tableViews.
I'm writing a little app that has two table views. I thought I needed
two dataSource classes, but as Mike Beam points out in his "Working
with tables" column, the methods that are required for tableView each
expect to receive an NSTableView parameter "This argument allows for
one dataSource object to manage data for multiple table views"
My question is, how do I test the tableView argument to determine which
table view, and therefore which set of data, is being requested?
The definition in Programming Topics says:
"Finally, numberOfRowsInTableView: simply returns the count of the
NSArray:
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
return [records count];
}
In each case, the NSTableView that sends the message is provided as
aTableView. A data source object that manages several sets of data can
choose the appropriate set based on which NSTableView sends the
message."
So presumably I can test aTableView in some way. I think I want to
write something like
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
if [aTableView xxxxxx] isEqual: @"people"])
return [people count];
else
return [things count];
}
Can anyone tell me what the xxxxxx should be?
Denis Stanton
email@hidden
_______________________________________________
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.