Typically, you should have a Controller for each NIB. So in the case of a Window NIB you would have an NSWindowController subclass as the File's Owner. Similarly for a View NIB you would have an NSViewController subclass as the File's Owner. In the case you present the NSWindowController subclass would instantiate the NSViewController subclass (passing it the appropriate View NIB) and then attach the NSViewController's view property to the window's view hierarchy.
Example in your Window Controller's awakFromNib method you would have the following:
- (void) awakeFromNib {
_viewController = [[MyViewController alloc] initWithNibName: @"MyView" bundle: nil];
[[[self window] contentView] addSubView: [_viewController view]];
}
You could also place this code in the windowDidLoad
method of your NSWindowController
subclass.