0

I'm doing an app and I was wondering how can you show a view like this:

dropdownwindow

BenMorel
  • 34,448
  • 50
  • 182
  • 322
pmerino
  • 5,900
  • 11
  • 57
  • 76

2 Answers2

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
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