<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTitlebarAccessoryViewController",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSTitlebarAccessoryViewController"
  },
  "title" : "NSTitlebarAccessoryViewController"
}
-->

# NSTitlebarAccessoryViewController

An object that manages a custom view—known as an accessory view—in the title bar–toolbar area of a window.

```
class NSTitlebarAccessoryViewController
```

## Overview

Because a title bar accessory view controller is contained in a visual effect view (that is, [`NSVisualEffectView`](/documentation/AppKit/NSVisualEffectView)), 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`](/documentation/AppKit/NSToolbar) fullscreen accessory APIs, such as [`fullScreenAccessoryView`](/documentation/AppKit/NSToolbar/fullScreenAccessoryView), you should use [`NSTitlebarAccessoryViewController`](/documentation/AppKit/NSTitlebarAccessoryViewController) APIs instead.

Typically, you create an `NSTitlebarAccessoryViewController` object, give it your custom view, set the [`layoutAttribute`](/documentation/AppKit/NSTitlebarAccessoryViewController/layoutAttribute) 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`](/documentation/AppKit/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 `NSTitlebarAccessoryViewController` subclass. Instead, you can override [`loadView()`](/documentation/AppKit/NSViewController/loadView()), and set the `view` property in that method.

> Note:
> `NSTitlebarAccessoryViewController` observes the view’s frame for changes. Depending on the value of ``doc://com.apple.appkit/documentation/AppKit/NSTitlebarAccessoryViewController/layoutAttribute``, you can change either the height or the width of the view. Specifically, you can change the view’s height when ``doc://com.apple.appkit/documentation/AppKit/NSTitlebarAccessoryViewController/layoutAttribute`` is <doc://com.apple.documentation/documentation/UIKit/NSLayoutConstraint/Attribute/bottom>, and you can change the view’s width when the ``doc://com.apple.appkit/documentation/AppKit/NSTitlebarAccessoryViewController/layoutAttribute`` is <doc://com.apple.documentation/documentation/UIKit/NSLayoutConstraint/Attribute/right> or <doc://com.apple.documentation/documentation/UIKit/NSLayoutConstraint/Attribute/left>. The remaining size direction is automatically set to the maximum size as required for the window.

## Topics

### Configuring a title bar accessory view controller

[`fullScreenMinHeight`](/documentation/AppKit/NSTitlebarAccessoryViewController/fullScreenMinHeight)

The visual minimum height of an accessory view that displays below the title bar when the window is in full screen mode.

[`layoutAttribute`](/documentation/AppKit/NSTitlebarAccessoryViewController/layoutAttribute)

The location of the accessory view, in relation to the window’s title bar.

### Configuring the scroll edge effect

[`preferredScrollEdgeEffectStyle`](/documentation/AppKit/NSTitlebarAccessoryViewController/preferredScrollEdgeEffectStyle)

The titlebar accessory’s preferred effect for content scrolling behind it.

[`NSScrollEdgeEffectStyle`](/documentation/AppKit/NSScrollEdgeEffectStyle)

Styles for a scroll view’s edge effect.

### Responding to view events

[`viewDidAppear()`](/documentation/AppKit/NSTitlebarAccessoryViewController/viewDidAppear())

Called when the title bar accessory view controller’s view is fully transitioned onto the screen.

[`viewDidDisappear()`](/documentation/AppKit/NSTitlebarAccessoryViewController/viewDidDisappear())

Called after the title bar accessory view controller’s view is removed from the window’s view hierarchy.

[`viewWillAppear()`](/documentation/AppKit/NSTitlebarAccessoryViewController/viewWillAppear())

Called after the title bar accessory view controller’s view has been loaded into memory is about to be added to the view hierarchy in the window.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)