The modal sheet window is not centered

I am trying to open a sheet window on my cocoa application:

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, but is shown in the lower left corner of the screen. I tried using the self.view window, but nothing changed. What should I do to place the sheet in the top window of my window?

+3
source share
1 answer

Make sure it is Visible At Launchnot set for your window sheet.

+10
source

All Articles