Contents

textField(at:)

Returns the text field at the given index

Declaration

func textField(at textFieldIndex: Int) -> UITextField?

Parameters

  • textFieldIndex:

    The index of the text field. The text field indices start at 0.

Return Value

The text field specified by index textFieldIndex.

Discussion

The number of text fields present in an alert is dependent on the style of the alert.

Alert Style

Text Fields

Default

No user-editable text fields.

Securetextinput

A single text field at index 0.

Plaintextinput

A single text field at index 0.

Loginandpasswordinput

The login field is at index 0. The password field is at index 1.

If your application attempts to retrieve a text field with an index that is out of bounds, the alert raises an rangeException.

See Also

Configuring buttons