Dynamic icon indicating copy to clipboard operation
Dynamic copied to clipboard

Hide close/minimize/maximize button in NSWindow

Open tommycarpi opened this issue 3 years ago • 1 comments

I've been trying to remove/hide the 3 top-left buttons of the view (close, minimize and maximize, but I stuck.

This is my current code, not working ...

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
#if targetEnvironment(macCatalyst)
    Dynamic(self.view.window?.nsWindow).standardWindowButton(0).isHidden = true
    Dynamic(self.view.window?.nsWindow).standardWindowButton(1).isHidden = true
    Dynamic(self.view.window?.nsWindow).standardWindowButton(2).isHidden = true
#endif
}

Did anyone manage to solve this?

tommycarpi avatar Oct 09 '22 22:10 tommycarpi

You can achieve this over a NSWindow setting the style mask https://developer.apple.com/documentation/appkit/nswindow/stylemask

forlayo avatar Jul 07 '23 17:07 forlayo