// @interface MainVC : NSViewController
self.mainVC = [[MainVC alloc]initWithNibName:@"MainVC" bundle:nil];
NSWindow *mainWindow = [NSWindow windowWithContentViewController:self.mainVC];
//@property (nonatomic, strong) NSWindowController *mainWindowController;
self.mainWindowController =[[NSWindowController alloc]initWithWindow:mainWindow];
self.mainVC.view.window.windowController = self.mainWindowController;
[self.mainWindowController.window makeKeyAndOrderFront:self];
[self.mainWindowController.window center];
[self.mainWindowController showWindow:nil];
NSWindow 直接加载NSViewController
最新推荐文章于 2021-09-22 15:01:31 发布