How exactly does an NSView, an NSViewController, and MainMenu.xib fit together?

社会主义新天地 提交于 2019-12-04 15:18:16

You almost got it.

I published a demo-project on Github, just for you ;)


Finally, you need to actually add the view to the window. Do this in your AppDelegate, or wherever you think is suitable.

- (void)awakeFromNib {
    [self.window.contentView addSubview:self.customViewController.view];
    [self.customViewController.view setFrame:[self.window.contentView bounds]];
}

Or course, you first need to make an outlet for your view controller:

@property (assign) IBOutlet ITCustomViewController *customViewController;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!