I\'ve already spent 2 full days trying to figure out how to use NSViewControllers in order to create a multiview application.
Here is what I do.
I have 2 Vie
This isn't much of an answer at the moment, however I have some concerns about your code that I wanted to work through with you.
Are you sure you have connected the outlets and actions in Interface Builder. Please verify this.
You don't need mainWindow
as there is already a window
property that points to the main window (verify this in Interface Builder). Also this looks wrong:
@synthesize mainWindow = mainwindow;
^
W
So dump that and just use the existing window
outlet provided by Xcode.
Don't re-create the view controllers if they already exist:
if (self.secondViewController == nil)
{
self.secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondViewController"
bundle:nil];
}
self.window.contentView = self.secondViewController.view;