Re: Communicate two window controllers.
Re: Communicate two window controllers.
- Subject: Re: Communicate two window controllers.
- From: Andreas Mayer <email@hidden>
- Date: Mon, 24 Sep 2007 02:30:31 +0200
Am 24.09.2007 um 00:44 Uhr schrieb Jere Gmail:
Is there anyway to access the B controller directly?
Yes. You store a reference to B someplace where you can reach it from A.
Exactly *where* depends on the case at hand.
If B is somehow dependent on A, you might want to store the reference
there.
If both windows are largely unrelated, you could store it in the
application delegate.
An object that is always accessible in a Cocoa application, is the
application object itself:
[NSApplication sharedApplication] or NSApp which is a shortcut for
this.
Almost all Cocoa applications have a delegate which, in turn, you get
with:
[NSApp delegate]
This is an excellent place to keep track of application global objects.
Thus you'd get the B controller using [[NSApp delegate]
bController] from anywhere inside your application.
Andreas
_______________________________________________
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