Alberto
Alberto

Reputation: 4282

How to make it from top ? (Cocoa sheet)

I have implemented my sheet (NSPanel) with the following method:

- (void)showInWindow:(NSWindow *)mainWindow {
if (!finestra1)
    [NSBundle loadNibNamed:@"XibName" owner:self];

[NSApp beginSheet:finestra1 modalForWindow:mainWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
[NSApp runModalForWindow:finestra1];   //This call blocks the execution until [NSApp stopModal] is called

}

The sheet is appearing in the middle of my screen, how to attach it to the top of my main window and make it appear with a "slide down" effect instead?

Thanks in advance.

Upvotes: 0

Views: 197

Answers (2)

paulmelnikow
paulmelnikow

Reputation: 17218

Have you tried simply removing the -runModalForWindow: line?

Upvotes: 2

John Sauer
John Sauer

Reputation: 4421

The way I was taught, the sheet you're presenting should be an NSWindow, not an NSPanel.

Let me know if you'd like me to upload a simple demo project.

Upvotes: 0

Related Questions