I have a subclass of NSWindowController that I use to load a window from the tip and display it on the screen. Below is the code that gets called when I want to show the window. In 10.6, when showCustomWindow is called, a window is displayed, but in 10.5, this method must be called twice to display the window.
-(IBAction)showCustomWindow:(id)sender
{
if(!windowController){
windowController = [[MyWindowController alloc] initWithWindowNibName:@"MyWindow"];
}
[windowController showWindow:self];
}
The window has "Visible at Startup", which is checked and unchecked from it, does not seem to matter.
Edit: I realized that the problem I encountered was not related to my NSWindowController or showWindow. I set it right. However, I found out that not all classes implement awakeFromNib. In one of my subclasses of NSView (which was in the nib that I was trying to load), I called [super awakeFromNib], which gave me "does not respond to the selector" (but only at 10.5, which is strange). So, I could just pull out [super awakeFromNib], but I decided that I hope it will be more reliable:
if([NSView instancesRespondToSelector:@selector(awakeFromNib)]) {
[super awakeFromNib];
}
This allowed my nib to boot normally and showWindow to work correctly.
source
share