<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UILabel/drawText(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UILabel(im)drawTextInRect:"
  },
  "title" : "drawText(in:)"
}
-->

# drawText(in:)

Draws the label’s text, or its shadow, in the specified rectangle.

```
func drawText(in rect: CGRect)
```

## Parameters

`rect`

The rectangle in which to draw the text.

## Discussion

Don’t call this method directly. Override this method if you want to modify the default drawing behavior for the label’s text.

By the time the system calls this method, the current graphics context is already configured with the default environment and text color for drawing. In your overridden method, you can configure the current context further and then invoke `super` to do the actual drawing, or you can do the drawing yourself. If you do render the text yourself, don’t invoke `super`.

---

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)