I have a MyCustomView subclassed from NSView designed in a .xib.
I would like to insert this view into some of my other xib\'s round my application. How should
For loading the view you need to add on your window:- Created custom class of view inheriting to NSViewController
#import
@interface NewViewController : NSViewController
@end
#import "NewViewController.h"
@implementation NewViewController
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Initialization code here.
}
return self;
}
@end
Your xib name is yourview.xib
- (void)windowDidLoad {
NSViewController *yourVC = [[NewViewController alloc] initWithNibName:@"NewViewController" bundle:nil];
[[[self window] contentView] addSubview:[yourVC view]];
}