osx - Swift/OS X - Remove Application Title Bar and Add Custom Close Button -


i'm working on little mac app want pretty specific style window. want remove application's menu bar completely, , go adding custom close button. (just little white 'x' no borders.) reason want i'm looking make application's background image cover entire window, not view controller area , gray title bar splotched above. far, window controller contains this:

self.window!.titlevisibility = nswindowtitlevisibility.hidden; self.window!.titlebarappearstransparent = true self.window!.movablebywindowbackground  = true 

all remove gray bar, buttons left were.

thanks reading, appreciated.

to show/hide window buttons want set visibility of nswindowbutton:

these constants provide way access standard title bar buttons:

enum nswindowbutton : uint {     case closebutton     case miniaturizebutton     case zoombutton     case toolbarbutton     case documenticonbutton     case documentversionsbutton     case fullscreenbutton } 

so use such set visibility:

self.window!.standardwindowbutton(nswindowbutton.closebutton)?.hidden = true 

any other constants want prevail work same way. set new custom close button example applications first responder terminate function.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

java.lang.NoClassDefFoundError When Creating New Android Project -

python - malformed header from script index.py Bad header -