Instance Property


The overlay view displayed on the left (or leading) side of the text field.


var leftView: UIView? { get set }


You can use the left overlay view to indicate the intended behavior of the text field. For example, you might display a magnifying glass in this location to indicate that the text field is a search field. The left overlay view flips automatically in a right-to-left user interface.

The left overlay view is placed in the rectangle returned by the leftViewRect(forBounds:) method of the receiver. The image associated with this property should fit the given rectangle. If it does not fit, it is scaled to fit. If you specify a control for your view, the control tracks and sends actions as usual.

See Also

Managing Overlay Views

var clearButtonMode: UITextField.ViewMode

Controls when the standard clear button appears in the text field.

var leftViewMode: UITextField.ViewMode

Controls when the left overlay view appears in the text field.

var rightView: UIView?

The overlay view displayed on the right (or trailing) side of the text field.

var rightViewMode: UITextField.ViewMode

Controls when the right overlay view appears in the text field.

enum UITextField.ViewMode

Defines the times at which overlay views appear in a text field.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software