• 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: Doe each NSTableView requires its own controller?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Doe each NSTableView requires its own controller?
      • From: mmalcolm crawford <email@hidden>
References: 
 >Doe each NSTableView requires its own controller? (From: email@hidden)
 >Re: Doe each NSTableView requires its own controller? (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Preferences
  • Next by Date: Re: Doe each NSTableView requires its own controller?
  • Previous by thread: Re: Doe each NSTableView requires its own controller?
  • Next by thread: Re: Doe each NSTableView requires its own controller?
  • Index(es):
    • Date
    • Thread