Class

NSStatusItem

An individual element displayed in the systemwide menu bar.

Overview

Instances are created by the NSStatusBar method statusItem(withLength:), which automatically adds the new status item to the status bar. The appearance and behavior of the status item are then set using the button property.

Topics

Getting the Item’s Status Bar

var statusBar: NSStatusBar?

The status bar in which the status item is displayed.

Managing the Status Item’s Behavior

var button: NSStatusBarButton?

The button that is displayed in the status bar.

var menu: NSMenu?

The pull-down menu that is displayed when the status item is clicked.

Configuring the Status Item’s Appearance

var length: CGFloat

The amount of space in the status bar that should be allocated to the status item.

Deprecated

var isEnabled: Bool

A Boolean that indicates whether the status item is enabled to respond to clicks.

Deprecated
var target: AnyObject?

The target object to which the status item’s action message is sent when the status item is clicked.

Deprecated
var action: Selector?

The selector that is sent to the status item’s target when the status item is clicked.

Deprecated
var doubleAction: Selector?

The selector that is sent to the status item’s target when the status item is double-clicked.

Deprecated
func sendAction(on: NSEvent.EventTypeMask)

Sets the conditions on which the status item sends action messages to its target.

Deprecated
func popUpMenu(NSMenu)

Displays a menu under a custom status bar item.

Deprecated
var title: String?

The string that is displayed at the status item’s position in the status bar.

Deprecated
var attributedTitle: NSAttributedString?

The attributed string that is displayed at the status item’s position in the status bar.

Deprecated
var image: NSImage?

The image that is displayed at the status item’s position in the status bar.

Deprecated
var alternateImage: NSImage?

The alternate image to be displayed when a status bar item is highlighted.

Deprecated
var highlightMode: Bool

A Boolean that indicates whether the status item is highlighted when it is clicked.

Deprecated
var toolTip: String?

The tool tip string that is displayed when the cursor pauses over the status item.

Deprecated
var view: NSView?

The custom view that is displayed at the status item’s position in the status bar.

Deprecated
func drawStatusBarBackground(in: NSRect, withHighlight: Bool)

Draws the menu background pattern for a custom status-bar item in regular or highlight pattern.

Deprecated

Type Properties

class let squareLength: CGFloat

Sets the status item length to the status bar thickness.

class let variableLength: CGFloat

Makes the status item length dynamic, adjusting to the width of its contents.

Relationships

Inherits From

Conforms To

See Also

Menu Bar Items

class NSStatusBar

An object that manages a collection of status items displayed within the system-wide menu bar.

class NSStatusBarButton

The appearance and behavior of an item in the systemwide menu bar.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software