gpt4 book ai didi

cocoa - 无边框 NSWindow 上的圆角

转载 作者:行者123 更新时间:2023-12-03 16:13:53 26 4
gpt4 key购买 nike

我正在创建一个应用程序和 I don't want a title bar :

If the title remains the same all the time, does it make sense to show it? For example, if an app doesn’t show the names of documents, or any other assets that it opens, and there is plenty of space at the top around other controls to grab onto if you want to move the window around, does the title serve much purpose? /image/C9mTo.png

问题是:我该怎么做?我尝试使用 [mainWindow setStyleMask:NSBorderlessWindowMask]; 但我无法使其具有圆角。我实在不知道怎么弄圆角。除此之外,我无法让它具有调整大小控件。如果我使用 [mainWindow setStyleMask:NSBorderlessWindowMask | NSResizableWindowMask]; 它不再是无边框的了。谁能帮我?谢谢。

最佳答案

虽然这是一个非常古老的问题......

现在在 OS X 10.11 上更容易了。

        window1.backgroundColor             =   NSColor.whiteColor()
window1.opaque = false
window1.styleMask = NSResizableWindowMask
| NSTitledWindowMask
| NSFullSizeContentViewWindowMask
window1.movableByWindowBackground = true
window1.titlebarAppearsTransparent = true
window1.titleVisibility = .Hidden
window1.showsToolbarButton = false
window1.standardWindowButton(NSWindowButton.FullScreenButton)?.hidden = true
window1.standardWindowButton(NSWindowButton.MiniaturizeButton)?.hidden = true
window1.standardWindowButton(NSWindowButton.CloseButton)?.hidden = true
window1.standardWindowButton(NSWindowButton.ZoomButton)?.hidden = true

window1.setFrame(CGRect(x: 400, y: 0, width: 400, height: 500), display: true)
window1.makeKeyAndOrderFront(self)

Here的完整工作示例。

这是从 another question 复制的答案。看起来有点不同,但可以同等回答。

关于cocoa - 无边框 NSWindow 上的圆角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4003975/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com