How can I create a window with transparent background with swift on osx?

后端 未结 4 774
难免孤独
难免孤独 2020-12-06 04:59

I want to create an osx/cocoa application on my mac, which does something very simple: Display a text string on my mac, with no background. Ultimately this will be a timer w

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 05:58

    Swift 3/4

    self.window?.isOpaque = false
    self.window?.hasShadow = false
    self.window?.backgroundColor = NSColor.clear
    self.window?.titlebarAppearsTransparent = true
    

提交回复
热议问题