我正在创建一个应用程序并且我不需要标题栏 http://www.usabilitypost.com/2010/10/22/no-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?
问题是:我该怎么做?我尝试使用[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 https://github.com/eonil/CocoaProgrammaticHowtoCollection/blob/a488695f79f3cf63fa05e167657609583b1e739c/ComponentUsages/BorderlessRoundWindowWithShadow/ExampleApplicationController.swift的完整工作示例。
这是复制的答案另一个问题 https://stackoverflow.com/a/27613308/246776。看起来有点不同,但可以同等回答。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)