Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modal sheet window not centered

I'm trying to open a sheet window on my cocoa app:

MyWindowController *controller = [[MyWindowController alloc] init];

NSWindow *window = [NSApp mainWindow];

[NSApp beginSheet:controller.window modalForWindow:window modalDelegate:self didEndSelector:nil contextInfo:nil];

The problem is that the sheet is not attached to the current window, instead it's shown in the bottom left of the screen. I've tried to use self.view window but nothing changed. What should I do to have the sheet positioned at the top-enter of my window?

like image 262
Oscar Del Ben Avatar asked Aug 27 '26 23:08

Oscar Del Ben


1 Answers

Make sure that Visible At Launch is unchecked for your sheet window.

like image 188
Wevah Avatar answered Aug 29 '26 16:08

Wevah



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!