Re: 2-way communication between nibs files
Re: 2-way communication between nibs files
- Subject: Re: 2-way communication between nibs files
- From: Nick Zitzmann <email@hidden>
- Date: Sun, 1 Aug 2004 12:46:42 -0600
On Aug 1, 2004, at 9:58 AM, Adam wrote:
What is the proper way to link up an app controller to other
controller classes to enable them to send msgs back and fourth?
There's a few ways of doing this:
1. Make your app controller the delegate of NSApplication, so you can
then call [NSApp delegate] to get a pointer to the app controller.
2. Make those instantiated objects singletons by storing a pointer to
the instantiated object as a global, and add a class method that
returns that global, like this: (warning - typed in Mail, untested, use
at your own risk, and all that)
static MyObject *sharedInstance = nil;
+ (MyObject *)sharedController
{
return sharedInstance;
}
- (void)awakeFromNib
{
sharedInstance = self;
// etc...
}
Then you can call that sharedController class method to communicate
with the class.
Nick Zitzmann
<
http://www.chronosnet.com/>
_______________________________________________
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.