Style: NSArrayController communicating with NSViewController
Style: NSArrayController communicating with NSViewController
- Subject: Style: NSArrayController communicating with NSViewController
- From: Arved von Brasch <email@hidden>
- Date: Fri, 03 Aug 2012 17:56:43 +1000
Hi List,
I've been reworking my application and I've found a solution I'm not particularly happy with, and was hoping to get some advice from others.
I have several views that are essentially views onto different tables. Each row in the table represents real items in the file system (because they are too large to store in a database). I have a typical scenario where each view's nib has a view and array controller. It all works relatively well.
Because of the size of the file system items, adding and deleting rows to the tables can take some time. This and a few other similar situations are about the only times the array controller needs to talk to the view controller (to update a progress bar and similar). The reverse situation of a shared search field in the toolbar is about the only instance where the view controller needs to talk with the array controller.
What's the best way to manage this two way communication? Having the view controller know explicitly about the array controller seems fine, as the array controller is part of the same nib as its view. Having the array controller know explicitly about the view controller doesn't seem like the right approach for the reverse. Notifications don't seem quite right either, as the array controller can only broadcast as it doesn't know the object to send directly to.
I've settled on having the array controller publish values and having the view controller notice by key-value observing. How have other people solved this problem?
Thanks for advice,
Arved
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden