Set initial size for NSWindow

I am trying to set the initial size for my NSWindow. Firstly, I tried to set the size using the storyboard.

enter image description here

And then I tried the code below, both do not work.

NSWindow *mainWindow = [[[NSApplication sharedApplication] windows] objectAtIndex:0];
mainWindow.titleVisibility=NSWindowTitleHidden;
NSRect frame = mainWindow.frame;
frame.size=CGSizeMake(1000, 200);
[mainWindow setFrame:frame display:YES];

I tried to check or uncheck the Restore box. How to set initial size for NSWindow? Why don't they work?

+4
source share

Source: https://habr.com/ru/post/1610136/


All Articles