【发布时间】:2012-08-22 14:15:57
【问题描述】:
如何在工具栏中显示NSWindow,如下图中的NSOpenPanel?
【问题讨论】:
标签: macos cocoa nswindow nsopenpanel cocoa-sheet
如何在工具栏中显示NSWindow,如下图中的NSOpenPanel?
【问题讨论】:
标签: macos cocoa nswindow nsopenpanel cocoa-sheet
从NIB文件的窗口属性中取消选中Visible At Launch,然后使用beginSheet:
[NSApp beginSheet:sheetWindow
modalForWindow:mainWindow
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
另外,NSSavePanel 提供了beginSheetModalForWindow 作为一种方便的方法:
[savePanel beginSheetModalForWindow:mainWindow completionHandler:^(NSInteger result) {
if (result != NSFileHandlingPanelOKButton) return;
// Do something
}];
【讨论】: