---
title: "drawImage(_:withFrame:in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbuttoncell/drawimage(_:withframe:in:)"
---

# drawImage(_:withFrame:in:)

Draws the image associated with the button’s current state.

## Declaration

```swift
func drawImage(_ image: NSImage, withFrame frame: NSRect, in controlView: NSView)
```

## Parameters

- `image`: The image associated with the button’s current state.
- `frame`: The bounding rectangle of the button.
- `controlView`: The control being drawn.

## Discussion

Discussion This method is called automatically when the button is redrawn; you should not call it directly. You specify the primary and alternate images for the button using Interface Builder.

## See Also

### Related Documentation

- [alternateImage](appkit/nsbuttoncell/alternateimage.md)

### Drawing the Button Content

- [drawBezel(withFrame:in:)](appkit/nsbuttoncell/drawbezel(withframe:in:).md)
- [drawTitle(_:withFrame:in:)](appkit/nsbuttoncell/drawtitle(_:withframe:in:).md)
