Search code examples
objective-cmacosnsviewcontroller

How to disable the titlebar close, minimize and zoom buttons in an NSViewController on Mac OS X


How do I disable/enable the titlebar close, minimize and zoom (red, yellow and green) buttons in an NSViewController - preferably from Objective-C/Swift.

I have searched the Storyboard properties but not found anything.


Solution

  • The close, minimize and zoom buttons are owned by the window. They are automatically enabled and disabled. Set styleMask of the window to enable or disable the buttons. You can enable and disable the buttons in the XIB.