<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSButtonCell/drawTitle(_:withFrame:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSButtonCell(im)drawTitle:withFrame:inView:"
  },
  "title" : "drawTitle(_:withFrame:in:)"
}
-->

# drawTitle(_:withFrame:in:)

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

```
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

The bounding rectangle for the text of the title.

## Discussion

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

## See Also

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

The title displayed by the button when it’s in its normal state as an attributed string.

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

The string displayed by the button when it’s in its alternate state.



---

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)