TitlebarAndToolbar

by robin

This is a showcase for several combinations of styles of title bar and toolbar of NSWindow.

221 Stars 12 Forks Last release: Not found 32 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Title bar and Toolbar of NSWindow examples

Platform Swift 4 License Twitter

This is a showcase for several combinations of styles of title bar and toolbar of NSWindow.

Title visibility

By default, the title of window is visible. window with title visible

window.titleVisibility = .visible

window with title invisible This is a streamlined toolbar which is a window with a toolbar while the title setting to invisible:

window.titleVisibility = .hidden

Example applications: Calendar, Notes, Xcode

Full size content view

When setting the NSWindow.StyleMask.fullSizeContentView, the content view extends to the whole window. The title bar and toolbar use a blur effect if visible.

swift
window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView)

When both title and toolbar are visible: full size content view

When title is invisible: full size content view without title Example applications: Safari, Photos, Wunderlist

Transparent title bar

If you want to hide the title bar but still need the window buttons (such as close button, minimize button and screen button), you can set the titlebar to transparent:

swift
window.titlebarAppearsTransparent = true

You may want to hide the title and use full size content view to get the following style.

swift
window.titlebarAppearsTransparent = true
window.titleVisibility = .hidden
window.styleMask.insert(NSWindow.StyleMask.fullSizeContentView)
transparent titlebar Example application: Reeder,

Title accessory view

According to the documentation, title accessory view is a custom view you can put along with the title bar.

There are three layout choices.

At the bottom of title bar: title accessory view at the bottom of the title bar It’s at the bottom of title bar or toolbar. You can set the height of the view.

On the left of the title bar: title accessory view on the left of the title bar You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar.

On the right of the title bar: title accessory view on the right of the title bar You can set the width of the view. The height of the title bar is fixed. If you set the height of the title accessory view, it doesn’t affect the height of the title and is clipped by the title bar. If the toolbar exist, it overlaps with the toolbar.

Example application: IA Writer

One thing to remember. You have to set the layout attribute before add the accessory view to the title.

Unified title and toolbar

Looks like this has been deprecated. No matter what you set, the title bar and toolbar are unified since Yosemite.

Author

Lu Yibin

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.