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

后端 未结 4 738
难免孤独
难免孤独 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:40

    Make the window non-opaque, and give it a clear background:

    func applicationDidFinishLaunching(aNotification: NSNotification) {
        window.opaque = false
        window.backgroundColor = NSColor.clearColor()
    }
    

提交回复
热议问题