2013-06-27 197 views
1

我可以用代码显示我的自定义NSWindowController为模态窗口:非模态对话框中有显示为模态窗口

TSAppDelegate* appDelegate = (TSAppDelegate*) [[NSApplication sharedApplication] delegate]; 
NSWindow* mainWindow = appDelegate.window; 

[NSApp beginSheet: [self window] 
    modalForWindow: mainWindow 
    modalDelegate: NULL 
    didEndSelector: NULL 
     contextInfo: NULL]; 
int acceptedModal = (int)[NSApp runModalForWindow: [self window]]; 
[NSApp endSheet: [self window]]; 
[[self window] close]; 

它的工作原理。但我需要非模态窗口。它必须显示为模态(见图),并且是非模态的。

enter image description here

我试图

TSAppDelegate* appDelegate = (TSAppDelegate*) [[NSApplication sharedApplication] delegate]; 
NSWindow* mainWindow = appDelegate.window; 

[[self window] setParentWindow: mainWindow]; 

[mainWindow addChildWindow: [self window] ordered: NSWindowAbove]; 

它可以作为非模态,但显示为正常的弹出窗口。

可能吗?

回答

3

看来你只是想要一个窗口在你的视图下降,但不是模态。

而不是使用工作表,你可以使用一个单独的视图,你动画进入和退出位置。

你必须自己做一些工作:设置正确的位置,动画视图,响应事件等。

相关问题