• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: right way to load initial data in controls when opening a window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: right way to load initial data in controls when opening a window


  • Subject: Re: right way to load initial data in controls when opening a window
  • From: Chris Giordano <email@hidden>
  • Date: Fri, 4 Apr 2003 12:44:38 -0500

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


Bill Cheeseman - <EMAIL REMOVED>
_______________________________________________
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.

  • Follow-Ups:
    • Re: right way to load initial data in controls when opening a window
      • From: Dan Bernstein <cocoa-dev%email@hidden>
References: 
 >Re: right way to load initial data in controls when opening a window (From: Steve Woodward <email@hidden>)

  • Prev by Date: RE: NSTexView not updated after setString
  • Next by Date: Re: right way to load initial data in controls when opening a window
  • Previous by thread: Re: right way to load initial data in controls when opening a window
  • Next by thread: Re: right way to load initial data in controls when opening a window
  • Index(es):
    • Date
    • Thread