Re: Doe each NSTableView requires its own controller?
Re: Doe each NSTableView requires its own controller?
- Subject: Re: Doe each NSTableView requires its own controller?
- From: "M. Uli Kusterer" <email@hidden>
- Date: Thu, 29 Jan 2004 20:42:12 +0100
At 0:00 Uhr -0800 28.01.2004, mmalcolm crawford wrote:
Most likely scenario: your controller will have two instance
variables (outlets), tableView1 and tableView2. Your controller
will also implement the NSTableView data source and delegate
methods. The first parameter in all of these is the table view
sending the message. Your implementations therefore check which
tableview is sending the message before returning the appropriate
value.
e.g.
- (int)numberOfRowsInTableView:(NSTableView *)tableView
{
if (tableView == tableView1)
{
return [array1 count];
}
return [array2 count];
}
That's not a very OO design, though ... I'd personally would consider
it much cleaner if the OP just wrote a generic MyTableViewController
class that talked to a model class. That way, all that's needed would
be a new instance of this controller, hooked up to the model and
another view, and he could have dozens of views into the same data.
Isn't that the main point of OO and MVC?
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
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.