我有一个 xib 文件,其中只有一个 NSPanel,我试图将此面板显示为模式表(带有beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:
)。此 xib 的文件所有者是一个控制器类“MyController”,它具有到 NSPanel 的 IBOutlet。
我正在寻找的是这样的:
...
MyController *controller = [[MyController alloc] init];
[NSApp beginSheet:controller.panel modalForWindow:[NSApp mainWindow] modalDelegate:controller didEndSelector:nil contextInfo:nil];
...
问题:MyController 必须继承自NSWindowController
orNSObject
吗?我试过了NSWindowController
,initWithWindowNibName:
但出口NSPanel
总是为零。
谢谢