I'm having some problems loading a second nib file containing a window as a sheet. The first method is the init method, the second displays the sheet, it is called from my AppController file.
After I click on the button to display the sheet I get this from the console (it initialises the second controller first):
2007-02-14 12:32:27.060 MyApp[714] nib loading successfully
2007-02-14 12:32:27.060 MyApp[714] sheet class=(null), window class=NSWindow
2007-02-14 12:32:27.060 MyApp[714] *** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], AppKit.subproj/NSApplication.m:3057
2007-02-14 12:32:27.061 MyApp[714] Modal session requires modal window
Now the problem seems to be that it isn't loading the nib properly but why not? The nib files are "localised" and are in an English.lproj directory...
Code:
-(id)initWithMainWindow:(NSWindow *)mainW{
[super init];
mainWindow=mainW;
BOOL success=[NSBundle loadNibNamed:@"MainOffWindows"
owner:self];
if(success!=YES){
NSLog(@"error loading MainOffWindows.nib");
return nil;
}
NSLog(@"nib loading successfully");
return self;
}
-(void)displaySheet{
NSLog(@"sheet class=%@, window class=%@",[sheet class],[mainWindow class]);
[NSApp beginSheet:sheet
modalForWindow:mainWindow
modalDelegate:self
didEndSelector:nil
contextInfo:NULL];
}
After I click on the button to display the sheet I get this from the console (it initialises the second controller first):
2007-02-14 12:32:27.060 MyApp[714] nib loading successfully
2007-02-14 12:32:27.060 MyApp[714] sheet class=(null), window class=NSWindow
2007-02-14 12:32:27.060 MyApp[714] *** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], AppKit.subproj/NSApplication.m:3057
2007-02-14 12:32:27.061 MyApp[714] Modal session requires modal window
Now the problem seems to be that it isn't loading the nib properly but why not? The nib files are "localised" and are in an English.lproj directory...