I'm doing an app and I was wondering how can you show a view like this:
Asked
Active
Viewed 262 times
2 Answers
1
That would be called a sheet. This guide should walk you through how to do them.
You basically make a NSWindow
that you would like to use as a sheet, then, when you want to show it, call:
[NSApp beginSheet: myCustomSheet modalForWindow: window modalDelegate: self didEndSelector: @selector(didEndSheet:returnCode:contextInfo:) contextInfo: nil];`
myCustomSheet
is obviously your sheet and window
is the window you want it to appear in. Set self
as the delegate and implement didEndSheet:returnCode:contextInfo:
:
- (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
{
[sheet orderOut:self];
}
Hook up a "close" button on your sheet to an IBAction
that closes the sheet.
- (IBAction)closeMyCustomSheet: (id)sender
{
[NSApp endSheet:myCustomSheet];
}
These sheets don't even need to be folded! XD

spudwaffle
- 2,905
- 1
- 22
- 29
-
Perfect, but can a sheet be placed a bit more down than the app titlebar? – pmerino Aug 03 '11 at 18:07
-
No, you will need a separate window for that. – spudwaffle Aug 03 '11 at 18:54
0
This is so called modal dialog. You can create one by dragging in (or loading from code) the separate NSPanel or NSWindow and display it by using one of runModal...
methods.

Eimantas
- 48,927
- 17
- 132
- 168