Contents

drawPlaceholder(in:)

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

Declaration

func drawPlaceholder(in rect: CGRect)

Parameters

  • rect:

    The rectangle in which to draw the placeholder text.

Discussion

You should not call this method directly. If you want to customize the drawing behavior for the placeholder 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 do the drawing yourself. If you do render the text yourself, you should not invoke super.

See Also

Drawing and positioning overrides