Instance Method

drawText(in:)

Draws the label's text (or its shadow) in the specified rectangle.

Declaration

func drawText(in rect: CGRect)

Parameters

rect

The rectangle in which to draw the text.

Discussion

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

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, do not invoke super.

See Also

Drawing and Positioning Overrides

func textRect(forBounds: CGRect, limitedToNumberOfLines: Int) -> CGRect

Returns the drawing rectangle for the label’s text.