在Swift中创建像这样的平滑框窗口? [英] Create plain box window like this in Swift?

查看:113
本文介绍了在Swift中创建像这样的平滑框窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是App Store上的Squish应用程序的屏幕截图。我如何能够制作一个窗口,圆角,标题栏和内容之间没有分隔符?

Below is a screenshot of the 'Squish' app on the App Store. How am I able to make a window like that, with rounded corners and no separator between the titlebar and content?

唯一的区别是我想要一个标题在标题栏。

The only difference is I want to have a title on the title bar.

简而言之,如何在图片中创建一个带有标题的窗口?

So in short, how do make a window like in the image but with a title?

推荐答案

在Xcode中创建一个新的NSWindow, ,并将 titlebarAppearsTransparent 属性设置为 true

Create a new NSWindow in Xcode, then create an outlet for it, and set the titlebarAppearsTransparent property to true:

@IBOutlet weak var windowBlank: NSWindow!

func applicationDidFinishLaunching(aNotification: NSNotification) {
    windowBlank.titlebarAppearsTransparent = true
    windowBlank.backgroundColor = NSColor.whiteColor()
} 

您还必须启用完整大小内容视图 c $ c> Attributes inspector 。

You also have to enable the Full size content view checkbox in the Attributes inspector.

这篇关于在Swift中创建像这样的平滑框窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆