【发布时间】:2011-01-01 13:20:32
【问题描述】:
我正在尝试创建一个自定义模式窗口,这是我目前拥有的代码:
NSWindowController *modalSheet = [[NSWindowController alloc]
initWithWindowNibName:@"MyCustomWindow" owner:self];
[NSApp beginSheet:[modalSheet window]
modalForWindow:[self windowForSheet]
modalDelegate:nil
didEndSelector:nil
contextInfo:nil];
窗口可以正常弹出,但不是模态的,例如您仍然可以对请求来自的父窗口执行操作。这个方法是从一个 NSDocument 对象调用的。
我尝试阅读:Using Custom Sheets
但是我不确定myCustomSheet 是什么,因为它没有在任何地方声明。我假设它是一个 NSWindow 实例变量。
我只是不明白为什么它不是模态的。任何帮助将非常感激。谢谢
【问题讨论】:
标签: objective-c cocoa nswindow nswindowcontroller cocoa-sheet