My preferences window code has each of the views, which are switched using a toolbar like yours, in a single .xib
with an outlet to each NSView
instance from the preference window controller:
@interface PreferenceController : NSWindowController <NSWindowDelegate, NSToolbarDelegate, FontChooserViewDelegate> {
// Main window
IBOutlet NSToolbar *_toolbar;
IBOutlet NSBox *_box;
IBOutlet NSButton *_restoreDefaultsButton;
IBOutlet NSView *_generalPrefsView;
IBOutlet NSView *_boardPrefsView;
IBOutlet NSView *_movesPrefsView;
// Other outlets to individual UI elements on some of the views.
}
So I'd say "Yes", you should do that, however there is no need to subclass the NSView
and hence no need to worry about special initialisation.
EDIT Actually, that's a lie; one of the views is subclassed but uses standard NSView
initialisation (initWithFrame
and awakeFromNib
).