Make controllers talk to each other
Make controllers talk to each other
- Subject: Make controllers talk to each other
- From: "Jim Thomason" <email@hidden>
- Date: Tue, 6 Jun 2006 15:04:54 -0500
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