ウィンドウの作成方法はわかりませんが、次の方法で作成できます。
AppDelegate.m
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Insert code here to initialize your application
fMainWinDelegate = nil;
fMainWinDelegate = [[MainWinDelegate alloc] init];
[fMainWinDelegate showWindow];
}
MainWindowDelegate.m
- (id)initWithWindow:(NSWindow *)AWindow
{
NSLog(@"MainWinDelegate::initWithWindow");
self = [super initWithWindow:AWindow];
if (self) {
// Initialization code here.
NSLog(@"MainWinDelegate::initWithWindow, we have self!");
}
return self;
}
- (void)awakeFromNib
{
NSLog(@"MainWinDelegate::awakeFromNib");
// only for debug and to be sure that is called many times
}
- (void)showWindow {
NSLog(@"MainWinDelegate::showWindow");
if (!self.window) {
[NSBundle loadNibNamed:@"MainWin" owner:self];
NSLog(@"MainWinDelegate::showWindow init part");
// do your init here
}
[self.window makeKeyAndOrderFront:self];
NSLog(@"MainWinDelegate::showWindow end");
}
これはログです:
MainWinDelegate::initWithWindow
MainWinDelegate::initWithWindow, we have self!
MainWinDelegate::showWindow
MainWinDelegate::awakeFromNib
MainWinDelegate::showWindow init part
MainWinDelegate::showWindow end