I'm trying to set an initial size for my NSWindow. First, I tried to set size using storyboard.
And then I tried the code below, the both don't 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 "Restorable" attribute. How can I set an initial size for NSWindow? Why are these not working?
I found a way to set the initial window size in the storyboard editor of Xcode. Instead of setting the size of the window, you need to set it on the ViewControllers first element like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With