---
title: "textRect(forBounds:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextfield/textrect(forbounds:)"
---

# textRect(forBounds:)

Returns the drawing rectangle for the text field’s text.

## Declaration

```swift
func textRect(forBounds bounds: CGRect) -> CGRect
```

## Parameters

- `bounds`: The bounding rectangle of the receiver.

## Return Value

Return Value The computed drawing rectangle for the label’s text.

## Discussion

Discussion You should not call this method directly. If you want to customize the drawing rectangle for the text, you can override this method and return a different rectangle. The default implementation of this method returns a rectangle that is derived from the control’s original bounds, but which does not include the area occupied by the receiver’s border or overlay views.

## See Also

### Drawing and positioning overrides

- [drawText(in:)](uikit/uitextfield/drawtext(in:).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)
