Re: cocoa-dev digest, Vol 2 #2166 - 14 msgs
Re: cocoa-dev digest, Vol 2 #2166 - 14 msgs
- Subject: Re: cocoa-dev digest, Vol 2 #2166 - 14 msgs
- From: Steve Woodward <email@hidden>
- Date: Sat, 5 Apr 2003 08:29:21 -0500
Thanks Dan, I will experiment with that method too. For anyone that was
following this thread the method Chris laid out did the trick.
Steve W
On Friday, April 4, 2003, at 02:35 PM,
email@hidden wrote:
Message: 5
Date: Fri, 4 Apr 2003 21:04:24 +0300
Subject: Re: right way to load initial data in controls when opening a
window
Cc: Steve Woodward <email@hidden>, email@hidden
To: Chris Giordano <email@hidden>
From: Dan Bernstein <cocoa-dev%email@hidden>
Actually, if a controllerB always needs to have a controllerA set, I
would make the designated initializer for controllerB
-initWithControllerA:(ControllerA *)aController;
-- Dan
On Friday, April 4, 2003, at 08:44 PM, Chris Giordano wrote:
Steve,
You need to tell Controller B about Controller A explicitly. You can
do so by simply adding an instance variable to your ControllerB class
and store the reference to your Controller A object there:
// in ControllerB.h:
@interface ControllerB : ...
{
...
ControllerA * controllerA;
}
// in ControllerB.m:
- (ControllerA *)controllerA
{
return controllerA;
}
- (void) setControllerA:(ControllerA *)newControllerA
{
controllerA = newControllerA;
}
Then, when in Controller A, when you create your Controller B object,
tell it about Controller A:
controllerB = [[ControllerB alloc] init];
[controllerB setControllerA:self];
Now, Controller A knows about Controller B and vice versa.
chris
On Friday, April 4, 2003, at 10:57 AM, Steve Woodward wrote:
FROM: Bill Cheeseman
DATE: 2003-04-04 13:25
on 03-04-03 7:30 PM, Steve Woodward at <EMAIL REMOVED> wrote:
The core of the problem for me is that I don't have a complete
handle
on inter-class communications. I know about sending messages and
about
accessor methods...but in this case I am confused because I am
creating
a window controller from another "parent" window controller and I'm
not
sure how the second window controller should reference data from the
first window controller.
In general, if controller B has a reference to controller A, you can
call
any method in A from B using standard Objective-C message sending
syntax.
There is my quandry...how do I give controller B a reference to
controller A? Controller A creates an instance of controller B and
therefore has a reference to it, but how can controller B reference
controller A?
Thanks Bill!!
Steve W
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.