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

# NSMenuItemCell

An object that handles the measurement and display of a single menu item in its encompassing frame.

```
class NSMenuItemCell
```

## Overview> Note:
> `NSMenuItemCell` is no longer used to draw menus. Using it does not affect the appearance of your menus.

## Topics

### Initializers

[`-  initWithCoder:`](/documentation/AppKit/NSMenuItemCell/init(coder:))

[`-  initTextCell:`](/documentation/AppKit/NSMenuItemCell/init(textCell:))

### Configuring Menu-Item Attributes

[`menuItem`](/documentation/AppKit/NSMenuItemCell/menuItem)

The menu item object associated with the cell.

### Calculating the Size of a Menu Item

[`-  calcSize`](/documentation/AppKit/NSMenuItemCell/calcSize())

Calculates the minimum required width and height of the receiver’s menu item.

[`needsSizing`](/documentation/AppKit/NSMenuItemCell/needsSizing)

A Boolean value indicating whether the size of the menu needs to be calculated.

[`imageWidth`](/documentation/AppKit/NSMenuItemCell/imageWidth)

The width of the image associated with the menu item.

[`titleWidth`](/documentation/AppKit/NSMenuItemCell/titleWidth)

The width of the menu item’s text, measured in points.

[`keyEquivalentWidth`](/documentation/AppKit/NSMenuItemCell/keyEquivalentWidth)

The width of the menu item’s key equivalent string.

[`stateImageWidth`](/documentation/AppKit/NSMenuItemCell/stateImageWidth)

The width of the image used to indicate the state of the menu item.

### Getting the Menu Item’s Drawing Rectangle

[`-  keyEquivalentRectForBounds:`](/documentation/AppKit/NSMenuItemCell/keyEquivalentRect(forBounds:))

Returns the rectangle into which the menu item’s key equivalent should be drawn.

[`-  stateImageRectForBounds:`](/documentation/AppKit/NSMenuItemCell/stateImageRect(forBounds:))

Returns the rectangle into which the menu item’s state image should be drawn.

[`-  titleRectForBounds:`](/documentation/AppKit/NSMenuItemCell/titleRect(forBounds:))

Returns the rectangle into which the menu item’s title should be drawn.

### Drawing the Menu Item

[`-  drawBorderAndBackgroundWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawBorderAndBackground(withFrame:in:))

Draws the borders and background associated with the receiver’s menu item (if any).

[`-  drawImageWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawImage(withFrame:in:))

Draws the image associated with the menu item.

[`-  drawKeyEquivalentWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawKeyEquivalent(withFrame:in:))

Draws the key equivalent associated with the menu item.

[`-  drawSeparatorItemWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawSeparatorItem(withFrame:in:))

Draws a menu item separator.

[`-  drawStateImageWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawStateImage(withFrame:in:))

Draws the state image associated with the menu item.

[`-  drawTitleWithFrame:inView:`](/documentation/AppKit/NSMenuItemCell/drawTitle(withFrame:in:))

Draws the title associated with the menu item.

[`needsDisplay`](/documentation/AppKit/NSMenuItemCell/needsDisplay)

A Boolean value indicating whether the menu item needs to be displayed.

### Assigning a Tag

[`tag`](/documentation/AppKit/NSMenuItemCell/tag)

The integer tag of the selected menu item.

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

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

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

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

[`Equatable`](/documentation/Swift/Equatable)

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

[`NSCopying`](/documentation/Foundation/NSCopying)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

### Inherits From

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

### Inherited By

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

---

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)