문제

How do you show a NSWindow from the toolbar, like the NSOpenPanel in the picture below?

enter image description here

도움이 되었습니까?

해결책

Uncheck Visible At Launch from the window properties in the NIB file and then use beginSheet:

[NSApp beginSheet:sheetWindow
           modalForWindow:mainWindow
           modalDelegate:self
           didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
           contextInfo:NULL];

Additionally, NSSavePanel provides beginSheetModalForWindow as a convenience method:

[savePanel beginSheetModalForWindow:mainWindow completionHandler:^(NSInteger result) {
    if (result != NSFileHandlingPanelOKButton) return;
    // Do something
}];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top