macosnsviewcontroller

NSViewController disable resize when presented as Sheet?


So I am presenting an NSViewController as a sheet of a window that has resize disabled.

The view controller that is presented as a sheet can still be resized.

How do I disable resizing of a NSViewController?


Solution

  • Swift 4:

    override func viewDidAppear() {
       // any additional code
       view.window!.styleMask.remove(.resizable)
    }
    

    By the way you can do this without writing code, here is how:

    disable resize window xcode