• 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: how to display a window from separate nibs?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >how to display a window from separate nibs? (From: "Ender Wiggins" <email@hidden>)

  • Prev by Date: Xcode 101 (Was: try/catch/throw/finally example?)
  • Next by Date: Re: Respond to Click in TextView
  • Previous by thread: how to display a window from separate nibs?
  • Next by thread: Respond to Click in TextView
  • Index(es):
    • Date
    • Thread