【发布时间】:2013-09-02 06:03:23
【问题描述】:
我有一个 AppDelegate 和 mainWindow.xib。我创建了另一个viewController 并从AppDelegate 调用,它运行良好。现在我怀疑是否可以将视图控制器设置为根而不将其添加到mainWindow.xib。是否必须使用mainWindow.xib 加载我们的视图?
我这样调用视图控制器
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
self.view = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
[self.window.contentView addSubview:self.view.view];
self.view.view.frame = ((NSView*)self.window.contentView).bounds;
}
【问题讨论】:
-
为什么所有的答案都是关于 UIKit 的
标签: objective-c macos cocoa nsview