NSTitlebar object manages a custom view—known as an accessory view—in the title bar–toolbar area of a window. Because a title bar accessory view controller is contained in a visual effect view (that is,
NSVisual), it automatically handles the blur behind the accessory view and the size and location changes for the content of the view when a window goes in and out of full screen mode. If you’re currently using
NSToolbar fullscreen accessory APIs, such as
full, you should use
NSTitlebar APIs instead.
- macOS 10.10+
Typically, you create an
NSTitlebar object, give it your custom view, set the
layout property to ensure that it displays correctly in relation to the title bar, and add the view controller to your window. For more information about
NSWindow methods you can use to add and remove a title bar accessory view controller, see Managing Title Bars.
Don’t override the
view property in your
NSTitlebar subclass. Instead, you can override
load, and set the
view property in that method.