Mac OSX - NSWindow背景全充满

1可以使用自定义NSWindow

class SZNoTitleWindow: NSWindow {

override init(contentRect: NSRect, styleMask style: NSWindowStyleMask, backing bufferingType: NSBackingStoreType, defer flag: Bool) {

super.init(contentRect: contentRect, styleMask: style, backing: bufferingType, defer: flag)

self.titleVisibility = NSWindowTitleVisibility.hidden

self.titlebarAppearsTransparent = true

}

}

2:在windowdidLoad中调用:

self.window?.titleVisibility = NSWindowTitleVisibility.hidden

self.window?.titlebarAppearsTransparent = true

前提是在xib文件中有设置 window 的属性 styleMask = NSWindowStyleMask.fullSizeContentView


self.window?.titlebarAppearsTransparent = true

你可能感兴趣的:(Mac OSX - NSWindow背景全充满)