Re: how to display a window from separate nibs?
Re: how to display a window from separate nibs?
- Subject: Re: how to display a window from separate nibs?
- From: "Alan Smith" <email@hidden>
- Date: Sun, 27 Aug 2006 09:22:29 -0400
Hi Ender,
What you want is to use + [NSBundle loadNibNamed:(NSString*)name
owner:(id)owner].
Some code like this should work.
Controller_A.h
@class Controller_B;
@interface Controller_A : NSObject
{
Controller_B *controller_b;
}
- (void)toolbarButtonAction;
@end
Controller _A.m
#import "Controller_A.h"
#import "Controller_B.h"
@implementation Controller_A
- (void)toolbarButtonAction
{
controller_b = [[Controller_B alloc] init];
[controller_b displayWindow];
}
@end
Controller_B.h
@interface Controller_B : NSObject
{
IBOutlet NSWindow *mainWindow;
}
- (void)displayWindow;
@end
Controller_B.m
#import "Controller_B.h"
@implementation Controller_B
- (id)init
{
if (self = [super init])
{
[NSBundle loadNibNamed: @"Controller_B_Nib" owner: self];
}
}
- (void)displayWindow
{
[mainWindow makeKeyAndOrderFront: nil];
}
@end
Look into + [NSBundle loadNibNamed:(NSString*)name owner:(id)owner]
for more info.
Enjoy, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden