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

# drawTitle(_:withFrame:in:)

Draws the button’s title centered vertically in a specified rectangle.

## Declaration

```swift
func drawTitle(_ title: NSAttributedString, withFrame frame: NSRect, in controlView: NSView) -> NSRect
```

## Parameters

- `title`: The title of the button.
- `frame`: The rectangle in which to draw the title.
- `controlView`: The control being drawn.

## Return Value

Return Value The bounding rectangle for the text of the title.

## Discussion

Discussion This method is called automatically when the button is redrawn; you should not call it directly.

## See Also

### Related Documentation

- [attributedTitle](appkit/nsbuttoncell/attributedtitle.md)
- [alternateTitle](appkit/nsbuttoncell/alternatetitle.md)

### Drawing the Button Content

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