---
title: "drawText(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextfield/drawtext(in:)"
---

# drawText(in:)

Draws the text field’s text in the specified rectangle.

## Declaration

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

## Parameters

- `rect`: The rectangle in which to draw the text.

## Discussion

Discussion You should not call this method directly. If you want to customize the drawing behavior for the text, you can override this method to do your drawing. By the time this method is called, 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, you should not invoke super.

## See Also

### Drawing and positioning overrides

- [textRect(forBounds:)](uikit/uitextfield/textrect(forbounds:).md)
- [placeholderRect(forBounds:)](uikit/uitextfield/placeholderrect(forbounds:).md)
- [drawPlaceholder(in:)](uikit/uitextfield/drawplaceholder(in:).md)
- [borderRect(forBounds:)](uikit/uitextfield/borderrect(forbounds:).md)
- [editingRect(forBounds:)](uikit/uitextfield/editingrect(forbounds:).md)
- [clearButtonRect(forBounds:)](uikit/uitextfield/clearbuttonrect(forbounds:).md)
- [leftViewRect(forBounds:)](uikit/uitextfield/leftviewrect(forbounds:).md)
- [rightViewRect(forBounds:)](uikit/uitextfield/rightviewrect(forbounds:).md)
