25

I'm using Xcode 7 on Yosemite. I created a new OS X application, and it came with a storyboard. When I launch the app, the app window is tiny.

What is the easiest way to set the default window size when the app launches?

Ideally I'm looking for a storyboard solution, not a programatic solution. However, if one does not exist, then a programatic solution will suffice. I don't want to set the minimum/maximum size of the window; the user should be able to size it as they see fit.

Senseful
  • 86,719
  • 67
  • 308
  • 465

2 Answers2

32

I figured it out...

You need to change the initial View Controller's View (NSView) size to whatever you want in the Size Inspector. You do not need to touch the Window Controller nor the Window.

Important: Don't forget to delete Xcode's derived data; otherwise it will remember the previous value that was used the first time the app was run.

Community
  • 1
  • 1
Senseful
  • 86,719
  • 67
  • 308
  • 465
5

Upon the view loading, so in the viewDidLoad method you can place either a call to a function or a line of code that looks like this :

self.view.window?.setFrame(NSRect(x:0,y:0,width: 1440,height: 790), display: true)

This will set your initial view to the NSRect you specify and display it.

Marcos Tanaka
  • 3,112
  • 3
  • 25
  • 41
user7211518
  • 51
  • 1
  • 3