带有圆角的NSWindow快速 [英] NSWindow with round corners in swift
本文介绍了带有圆角的NSWindow快速的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要一个带有圆角的窗口.但是我到处都是白点.
I want a window with a rounded corners. But I get a white spot in every corner.
代码:
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
输出:
如何摆脱角落里的白点?
How to get rid of those white spot in the corners?
推荐答案
也将此代码添加到您的代码中
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.
试一下并更新一下我.
这篇关于带有圆角的NSWindow快速的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文