嗨,所以我一直在互联网上查找,并找到了关于这个主题的各种有用的信息,但似乎都没有工作
标题栏和窗口的其余部分混合在一起。从互联网上到目前为止,代码iv已经在我的viewDidLoad()
中 self.view.window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
self.view.window?.styleMask = (self.view.window?.styleMask)! | NSFullSizeContentViewWindowMask
self.view.window?.titlebarAppearsTransparent = true
self.view.window?.movableByWindowBackground = true
但那不做任何事情。我是Mac开发的新手(通常是ios)所以非常感谢所有的帮助!
答案 0 :(得分:4)
创建NSWindowController
的子类并将您的代码放在windowDidLoad()中。
override func windowDidLoad() {
super.windowDidLoad()
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
self.window?.appearance = NSAppearance(named: NSAppearanceNameVibrantDark)
self.window?.styleMask = (self.window?.styleMask)! | NSFullSizeContentViewWindowMask
self.window?.titlebarAppearsTransparent = true
self.window?.movableByWindowBackground = true
}