如何从 NSVisualEffectView 中删除不需要的边框?

问题描述 投票:0回答:0

我正在尝试使用 NSVisualEffectView 创建一个无边框窗口,如下所示:

class AppDelegate: NSObject, NSApplicationDelegate {
    
    private lazy var window: NSWindow = NSWindow()
    
    func applicationDidFinishLaunching(_ aNotification: Notification) {
        
        window.styleMask = [.borderless]
        window.backingType = .buffered

        let blurView: NSVisualEffectView = NSVisualEffectView()
        blurView.wantsLayer = true
        blurView.blendingMode = .behindWindow
        blurView.material = .popover
        blurView.layer?.cornerRadius = 50
        blurView.state = .active
        
        window.contentView = blurView
        window.setContentSize(CGSize(width: 250, height: 250))
        window.backgroundColor = .clear
        
        window.setFrameAutosaveName("Main Window")
        window.isMovableByWindowBackground = true
        
        window.makeKeyAndOrderFront(window)
    }
}

问题是由于 NSVisualEffectView 而创建了一个边框,我不需要它。我怎样才能删除它?

enter image description here

swift cocoa appkit nsvisualeffectview
© www.soinside.com 2019 - 2024. All rights reserved.