Set NSWindow Size programmatically

前端 未结 6 2067
栀梦
栀梦 2021-02-01 19:19

How can I set the window size programmatically? I have a window in IB and I want to set the size of it in my code to make it larger.

6条回答
  •  一生所求
    2021-02-01 20:04

    Swift version

    var frame = self.view.window?.frame
    frame?.size = NSSize(width: 400, height:200)
    self.view.window?.setFrame(frame!, display: true)
    

提交回复
热议问题