Create plain box window like this in Swift?

前端 未结 1 405
有刺的猬
有刺的猬 2021-01-21 11:14

Below is a screenshot of the \'Squish\' app on the App Store. How am I able to make a window like that, with rounded corners and no separator between the titlebar and content?

相关标签:
1条回答
  • 2021-01-21 11:31

    Create a new NSWindow in Xcode, then create an outlet for it, and set the titlebarAppearsTransparent property to true:

    @IBOutlet weak var windowBlank: NSWindow!
    
    func applicationDidFinishLaunching(aNotification: NSNotification) {
        windowBlank.titlebarAppearsTransparent = true
        windowBlank.backgroundColor = NSColor.whiteColor()
    } 
    

    You also have to enable the Full size content view checkbox in the Attributes inspector.

    0 讨论(0)
提交回复
热议问题