Instance Method

placeholderRect(forBounds:)

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

Declaration

func placeholderRect(forBounds bounds: CGRect) -> CGRect

Parameters

bounds

The bounding rectangle of the receiver.

Return Value

The computed drawing rectangle for the placeholder text.

Discussion

You should not call this method directly. If you want to customize the drawing rectangle for the placeholder text, you can override this method and return a different rectangle.

If the placeholder string is empty or nil, this method is not called.

See Also

Drawing and Positioning Overrides

func textRect(forBounds: CGRect) -> CGRect

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

func drawText(in: CGRect)

Draws the receiver’s text in the specified rectangle.

func drawPlaceholder(in: CGRect)

Draws the receiver’s placeholder text in the specified rectangle.

func borderRect(forBounds: CGRect) -> CGRect

Returns the receiver’s border rectangle.

func editingRect(forBounds: CGRect) -> CGRect

Returns the rectangle in which editable text can be displayed.

func clearButtonRect(forBounds: CGRect) -> CGRect

Returns the drawing rectangle for the built-in clear button.

func leftViewRect(forBounds: CGRect) -> CGRect

Returns the drawing rectangle of the receiver’s left overlay view.

func rightViewRect(forBounds: CGRect) -> CGRect

Returns the drawing location of the receiver’s right overlay view.