---
title: "drawStateImage(withFrame:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsmenuitemcell/drawstateimage(withframe:in:)"
---

# drawStateImage(withFrame:in:)

Draws the state image associated with the menu item.

## Declaration

```swift
func drawStateImage(withFrame cellFrame: NSRect, in controlView: NSView)
```

## Parameters

- `cellFrame`: A rectangle defining the receiver’s frame area.
- `controlView`: The view object that contains this cell (usually an doc://com.apple.appkit/documentation/AppKit/NSControl object).

## Discussion

Discussion This method invokes stateImageRect(forBounds:), passing it cellFrame, to calculate the rectangle in which to draw the state image. This method is invoked by the cell’s drawWithFrame: method. You should not need to invoke it directly. Subclasses may override this method to control the drawing of the state image.

## See Also

### Drawing the Menu Item

- [drawBorderAndBackground(withFrame:in:)](appkit/nsmenuitemcell/drawborderandbackground(withframe:in:).md)
- [drawImage(withFrame:in:)](appkit/nsmenuitemcell/drawimage(withframe:in:).md)
- [drawKeyEquivalent(withFrame:in:)](appkit/nsmenuitemcell/drawkeyequivalent(withframe:in:).md)
- [drawSeparatorItem(withFrame:in:)](appkit/nsmenuitemcell/drawseparatoritem(withframe:in:).md)
- [drawTitle(withFrame:in:)](appkit/nsmenuitemcell/drawtitle(withframe:in:).md)
- [needsDisplay](appkit/nsmenuitemcell/needsdisplay.md)
