8

I want a window with a rounded corners. But I get a white spot in every corner.

Code:

let effect = NSVisualEffectView(frame: NSRect(x: 0, y: 0, width: 0, height: 0))
effect.blendingMode = .behindWindow
effect.state = .active
effect.material = .dark
effect.wantsLayer = true
effect.layer?.cornerRadius = 15.0
window.contentView = effect
window.titlebarAppearsTransparent = true
window.titleVisibility = .hidden

Output:

enter image description here

How to get rid of those white spot in the corners?

SkrewEverything
  • 2,393
  • 1
  • 19
  • 50
ssh
  • 491
  • 1
  • 8
  • 19

1 Answers1

10

Also add this code to your code

window.isOpaque = false
window.backgroundColor = .clear

I don't have my machine to check but once I had the same issue and I think I resolved it by using above code. I will check when I get back to my machine.

Give it a shot and update me.

SkrewEverything
  • 2,393
  • 1
  • 19
  • 50
  • can you help me with this question -> http://stackoverflow.com/questions/42774922/how-to-add-buttons-when-nsvisualeffectview-is-used – ssh Mar 14 '17 at 03:40
  • 1
    I used this and it works great. However, there is still a very thin line at the top corners of the window that I cannot get rid of (that's a remaining of the titleBar, despite it is transparent). Note that I cannot use 'Hide Title' in IB ; for some reason (may be because that is within the initial controller of the Storyboard), windowDidBecomeMain is no more called if i hide. – claude31 Nov 03 '19 at 19:49