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

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?
source
share