DotMac

プログラムに関する覚え書き等

NSWindow (Open Multiple Sub Windows using seperate nib file)

Open Multiple Sub Windows



(1) create document based NIB file and connect properly as shown below.

(SubWindowController is a sub-class of NSObject. Initiate and make file of it.)



Connect owner to window


p1




Connect window to controller


p2


(2) Coding


To open,


	NSWindowController* wc = 
	[[NSWindowController alloc] initWithWindowNibName:@"NIBFilenameHere(without.nib)"];
	
	NSWindow* aWindow = [wc window];
	[wc showWindow:self];

When window is opened, subWindowController instance is made.

Methods can be implemented in "SubWindowController.m"


#import "SubWindowController.h"

@implementation SubWindowController
- (void)windowDidBecomeKey:(NSNotification *)aNotification
{

}
- (void)windowDidExpose:(NSNotification *)aNotification
{

}

@end

 

Parting Words (著作権, 連絡先情報, etc.)