Re: Make controllers talk to each other
Re: Make controllers talk to each other
- Subject: Re: Make controllers talk to each other
- From: Marcus Zarra <email@hidden>
- Date: Tue, 6 Jun 2006 14:09:03 -0600
What about having both controllers talk to the model and then the
controllers are each updated through KVO/KVC? As long as the model
is announcing changes via KVO/KVC then the controllers (and the
views) would be notified automatically.
Marcus S. Zarra
Zarra Studios LLC
www.zarrastudios.com
Simply Elegant Software for OS X
On Jun 6, 2006, at 2:04 PM, Jim Thomason wrote:
Are there any examples floating around about the accepted ways to have
controllers talk to each other?
Specifically, I have this in my app:
a custom view accepting input from the user. This relays to a
controller, which updates my model as appropriate.
But, potentially simultaneously, I also have a separate controller
receiving events over the network. This also updates the model. But,
it also needs to inform the custom view managed by the other
controller to update with the information that came in over the net.
Further, my View Controller needs to inform the Network Controller
about any local changes so that they can be broadcast along the
network connection.
So how should I go about doing this?
I've come up with a few options:
1) Re-factor the two controllers into one and feed all inputs through
this single squeeze point. I'm afraid the combined controller would be
too monolithic, though.
2) Give each controller a reference to the other one and have them
directly call each other's methods as necessary. This seems messy to
me, though. Something about too many criss-crossing connections.
3) Use notifications and post post post. I had tried this initially
but was having trouble keeping things in sync. I hadn't tried positing
with the deliverImmediately flag set yet, though, so I don't know if
that would resolve the issues.
Any suggestions? What's the best road to go down?
-Jim......
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden