• 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:39:21 +0100

DISCLAIMER: I'm still not fully comfy with the MVC paradigm. I think I understand it now, but I still may make some mistakes. If any of the old-timers thinks they know better, please correct me.

At 22:42 Uhr -0800 27.01.2004, email@hidden wrote:
In my application I'm about to add an additional NSTableView instance. Do I now need to create a new controller to implement its delegate methods?

That depends on what the second NSTableView will contain. You can have one controller shared by several table views, you just have to make sure they use the tableView variable they get from the callbacks, and you have to come up with a scheme that allows the controller to cause an update in both table views whenever the model changes. In the case of an NSTableView, you can use key-value-access, which would allow you to show different columns of the same model objects without any special code in the controller.

I would think so. If this is the case, how do I reference objects in the other table view's controller?

In more complicated cases (e.g. if you expect to be implementing other views for the same data besides NSTableViews in the future) the best approach would probably be to move from a combined controller/model hybrid design to a full Model-Controller-View design.

I.e., move the actual data out into a separate class (the model) with all its management stuff (like add, delete, load, save), and create two controllers that mediate between the model and the individual views. Each controller would then be responsible for one view, and would be notified by the model whenever another view changes the data.
--
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.
References: 
 >Doe each NSTableView requires its own controller? (From: email@hidden)

  • Prev by Date: Re: Doe each NSTableView requires its own controller?
  • Next by Date: Re: List of Images like in System Preferences
  • Previous by thread: Re: Doe each NSTableView requires its own controller?
  • Next by thread: removing focus rings
  • Index(es):
    • Date
    • Thread