macOS window with integrated title bar and toolbar?

MacosInterface BuilderOsx Yosemite

Macos Problem Overview


In macOS how can I create a window with an "integrated title bar and toolbar" in Xcode and/or Interface Builder?

This is the "fat title bar" type of window that was added to apps such as Safari and Calendar in OS X 10.10 Yosemite. Unified title bar and toolbar plus other gadgets.

> macOS Human Interface Guidelines: Title Bar and Toolbar > > A toolbar, when included, resides beneath the title bar (or is integrated with the title bar) and includes controls—known as toolbar items—that provide quick access to frequently used commands and features. > > Integrated title bar and toolbar > > Integrated title bar and toolbar

Macos Solutions


Solution 1 - Macos

  1. Create a standard toolbar.

  2. When the window loads, set titleVisibility to hidden:

    // Objective-C
    window.titleVisibility = NSWindowTitleHidden;
    
    // Swift
    window?.titleVisibility = .hidden
    

Solution 2 - Macos

As of Xcode 10, you can do this in your XIB or storyboard by turning on the “Hide Title” check box under the window's title in the window's Attributes Inspector.

xib demo

Note also that you should use the “Textured Rounded” style for toolbar buttons.

Solution 3 - Macos

In your window controller's windowDidLoad():

window?.titleVisibility = .hidden

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKornelView Question on Stackoverflow
Solution 1 - MacosKornelView Answer on Stackoverflow
Solution 2 - Macosrob mayoffView Answer on Stackoverflow
Solution 3 - MacosSammy The HandView Answer on Stackoverflow