---
title: NSTitlebarAccessoryViewController
framework: appkit
role: symbol
role_heading: Class
path: appkit/nstitlebaraccessoryviewcontroller
---

# NSTitlebarAccessoryViewController

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

## Declaration

```swift
class NSTitlebarAccessoryViewController
```

## Overview

Overview Because a title bar accessory view controller is contained in a visual effect view (that is, 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 fullscreen accessory APIs, such as fullScreenAccessoryView, you should use NSTitlebarAccessoryViewController APIs instead. Typically, you create an NSTitlebarAccessoryViewController object, give it your custom view, set the 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 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(), and set the view property in that method. note: NSTitlebarAccessoryViewController observes the view’s frame for changes. Depending on the value of layoutAttribute, you can change either the height or the width of the view. Specifically, you can change the view’s height when layoutAttribute is NSLayoutConstraint.Attribute.bottom, and you can change the view’s width when the layoutAttribute is NSLayoutConstraint.Attribute.right or 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](appkit/nstitlebaraccessoryviewcontroller/fullscreenminheight.md)
- [layoutAttribute](appkit/nstitlebaraccessoryviewcontroller/layoutattribute.md)

### Configuring the scroll edge effect

- [preferredScrollEdgeEffectStyle](appkit/nstitlebaraccessoryviewcontroller/preferredscrolledgeeffectstyle.md)
- [NSScrollEdgeEffectStyle](appkit/nsscrolledgeeffectstyle.md)

### Responding to view events

- [viewDidAppear()](appkit/nstitlebaraccessoryviewcontroller/viewdidappear().md)
- [viewDidDisappear()](appkit/nstitlebaraccessoryviewcontroller/viewdiddisappear().md)
- [viewWillAppear()](appkit/nstitlebaraccessoryviewcontroller/viewwillappear().md)

### Instance Properties

- [automaticallyAdjustsSize](appkit/nstitlebaraccessoryviewcontroller/automaticallyadjustssize.md)
- [isHidden](appkit/nstitlebaraccessoryviewcontroller/ishidden.md)

## Relationships

### Inherits From

- [NSViewController](appkit/nsviewcontroller.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSAnimatablePropertyContainer](appkit/nsanimatablepropertycontainer.md)
- [NSAnimationDelegate](appkit/nsanimationdelegate.md)
- [NSCoding](foundation/nscoding.md)
- [NSEditor](appkit/nseditor.md)
- [NSExtensionRequestHandling](foundation/nsextensionrequesthandling.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSeguePerforming](appkit/nssegueperforming.md)
- [NSStandardKeyBindingResponding](appkit/nsstandardkeybindingresponding.md)
- [NSTouchBarProvider](appkit/nstouchbarprovider.md)
- [NSUserActivityRestoring](appkit/nsuseractivityrestoring.md)
- [NSUserInterfaceItemIdentification](appkit/nsuserinterfaceitemidentification.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Content Controllers

- [NSWindowController](appkit/nswindowcontroller.md)
- [NSViewController](appkit/nsviewcontroller.md)
