Re: Two controllers in a window, how do I get one to run a function in another?
Re: Two controllers in a window, how do I get one to run a function in another?
- Subject: Re: Two controllers in a window, how do I get one to run a function in another?
- From: Graham Cox <email@hidden>
- Date: Fri, 28 Aug 2009 00:04:02 +1000
On 27/08/2009, at 11:55 PM, Support wrote:
I want to have two NSObjects (controllers) - one for the tableview
and all the actions that it needs to perform, and one for the web
view. I am having difficulty getting the tableview controller to
tell the webview controller to display a particular page. And I
can't find anything about this subject in my Cocoa books or on the
web. Am I barking up the wrong tree here? Should I only have one
controller per window?
I'd be most grateful for any enlightenment.
One controller for each view sounds like a good plan. There's
certainly no requirement that you can have only one controller per
window.
It's up to you how your controllers communicate. For example, your
Webview controller could have a method "showURL:" which accepts a
NSURL object, and the first controller can turn the selection into one
and pass it to the second. That's all there is to it pretty much. You
could probably make it nice and complicated and involve bindings and
so on, but why bother? K.I.S.S...
--Graham
_______________________________________________
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