Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show a NSPanel as a sheet

I'm trying to show a NSPanel as a sheet. I'm naively doing something along those lines:

SheetController *sheetController = [[[SheetController alloc]
                                      initWithWindowNibName:@"Sheet"] autorelease];

[[NSApplication sharedApplication] beginSheet:sheetController.window 
                               modalForWindow:self.window
                                modalDelegate:self
                               didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) 
                                  contextInfo:nil];

For some reason that eludes me, this isn't working. When this part of the code is called, the sheet momentarily flashes (because of the autorelease message). The sheet is never hooked to window.

If anyone can point me to where I can find more information, that would be very appreciated.

like image 284
Martin Cote Avatar asked Sep 22 '09 01:09

Martin Cote


1 Answers

This sounds like a classic case of having checked the "Visible at Launch" box for the panel in IB. Turn that off.

like image 121
Mike Abdullah Avatar answered Sep 18 '22 23:09

Mike Abdullah