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: Chase Meadors <email@hidden>
- Date: Sun, 30 Aug 2009 23:04:24 -0500
Define an outlet in "MyController"
IBOutlet id documentController;
Connect it to "MyDocument" in interface builder. Then call:
[documentController fileString];
---
This is a minor annoyance when using multiple controllers, as they
will probably need information from the other controllers.
On Aug 30, 2009, at 8:07 PM, BareFeet wrote:
Hi All,
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've read the replies but can't get any approach to work. I must be
missing something simple.
For example, I have an instance method called "fileString" in my
"MyDocument" class, that returns the path to that document. But how
do I call it from my "MyController"? In MyController.m, when I say:
#import "MyDocument.h"
...
[MyDocument fileString];
I get a runtime error:
+[MyDocument fileString]: unrecognized selector sent to class.
The error makes sense because I am trying to call an instance method
on a class. But how to I refer to the instance of MyDocument that
sits in the same nib instance as the MyController that is calling it?
When you stop laughing, can you please lay it out for me.
I also tried to use bindings, which I've made work well for linking
text views, table columns, even outline view columns, to data in my
model. But I can't seem to set up bindings to link an instance
variable in one controller to another controller. So I guess
bindings are only for linking view objects to model objects, yes?
Thanks,
Tom
BareFeet
_______________________________________________
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
_______________________________________________
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