<div class="meta" robots="noindex">

</div>

Class

# iOSTextField

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<div class="warning">

<div class="title">

Warning

</div>

This item was deprecated in version 2020r2. Please use `MobileTextField</api/user_interface/mobile/mobiletextfield>` as a replacement.

</div>

## Description

A single-line text field for text.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                  | Type                                     | Read-Only | Shared |
|-------------------------------------------------------|------------------------------------------|-----------|--------|
| `AccessibilityHint<iostextfield.accessibilityhint>`   | `Text</api/deprecated/text>`             |           |        |
| `AccessibilityLabel<iostextfield.accessibilitylabel>` | `Text</api/deprecated/text>`             |           |        |
| `Enabled<iostextfield.enabled>`                       | `Boolean</api/data_types/boolean>`       |           |        |
| `Height<iostextfield.height>`                         | `Double</api/data_types/double>`         | ✓         |        |
| `KeyboardType<iostextfield.keyboardtype>`             | iOSKeyboardType                          |           |        |
| `Left<iostextfield.left>`                             | `Double</api/data_types/double>`         | ✓         |        |
| `Name<iostextfield.name>`                             | `Text</api/deprecated/text>`             | ✓         |        |
| `Parent<iostextfield.parent>`                         | `iOSControl</api/deprecated/ioscontrol>` | ✓         |        |
| `Password<iostextfield.password>`                     | `Boolean</api/data_types/boolean>`       |           |        |
| `PlaceHolder<iostextfield.placeholder>`               | `Text</api/deprecated/text>`             |           |        |
| `Text<iostextfield.text>`                             | `Text</api/deprecated/text>`             |           |        |
| `TextAlignment<iostextfield.textalignment>`           | iOSTextAlignment                         |           |        |
| `TextColor<iostextfield.textcolor>`                   | `Color</api/data_types/color>`           |           |        |
| `TextFont<iostextfield.textfont>`                     | `iOSFont</api/deprecated/iosfont>`       |           |        |
| `Top<iostextfield.top>`                               | `Double</api/data_types/double>`         | ✓         |        |
| `Visible<iostextfield.visible>`                       | `Boolean</api/data_types/boolean>`       |           |        |
| `Width<iostextfield.width>`                           | `Double</api/data_types/double>`         | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                              | Parameters                                                         | Returns                                                   | Shared |
|---------------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------|--------|
| `AddConstraint<iostextfield.addconstraint>`       | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `AddControl<iostextfield.addcontrol>`             | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `Control<iostextfield.control>`                   | index As `Integer</api/data_types/integer>`                        | `MobileControl</api/user_interface/mobile/mobilecontrol>` |        |
| `ControlCount<iostextfield.controlcount>`         |                                                                    | `Integer</api/data_types/integer>`                        |        |
| `Handle<iostextfield.handle>`                     |                                                                    | `Ptr</api/data_types/additional_types/ptr>`               |        |
| `Invalidate<iostextfield.invalidate>`             |                                                                    |                                                           |        |
| `RemoveConstraint<iostextfield.removeconstraint>` | constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`  |                                                           |        |
| `RemoveControl<iostextfield.removecontrol>`       | child As `MobileControl</api/user_interface/mobile/mobilecontrol>` |                                                           |        |
| `SetTintColor<iostextfield.settintcolor>`         | value As `Color</api/data_types/color>`                            |                                                           |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                  | Parameters | Returns |
|---------------------------------------|------------|---------|
| `Close<iostextfield.close>`           |            |         |
| `Open<iostextfield.open>`             |            |         |
| `TextChange<iostextfield.textchange>` |            |         |

## Property descriptions

<div id="iostextfield.accessibilityhint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.AccessibilityHint

**AccessibilityHint** As `Text</api/deprecated/text>`

The accessibility hint is a longer description that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityHint = "Click to calculate the value and display the next view."
```

<div id="iostextfield.accessibilitylabel">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.AccessibilityLabel

**AccessibilityLabel** As `Text</api/deprecated/text>`

The accessibility label of of a control is a short name that is read aloud when VoiceOver is enabled.

``` xojo
Me.AccessibilityLabel = "Calculate the value."
```

<div id="iostextfield.enabled">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Enabled

**Enabled** As `Boolean</api/data_types/boolean>`

Indicates if the field is enabled or disabled.

Disable the text field

``` xojo
TextField1.Enabled = False
```

<div id="iostextfield.height">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Height

**Height** As `Double</api/data_types/double>`

The height of the control.

This property is read-only.

<div id="iostextfield.keyboardtype">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.KeyboardType

**KeyboardType** As iOSKeyboardType

Specifies the type of keyboard to use with the text field. The various types are specified using the iOSKeyboardTypes enumeration.

Use the number pad for the text field:

``` xojo
Me.KeyboardType = iOSKeyboardTypes.NumberPad
```

<div id="iostextfield.left">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Left

**Left** As `Double</api/data_types/double>`

The left position of the control.

This property is read-only.

<div id="iostextfield.name">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Name

**Name** As `Text</api/deprecated/text>`

The name of the control. This can only be set in the Inspector. Use the name to refer to the control.

This property is read-only.

<div id="iostextfield.parent">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Parent

**Parent** As `iOSControl</api/deprecated/ioscontrol>`

Indicates the control's parent object, if it has one. If there is no parent, this is Nil.

This property is read-only.

<div id="iostextfield.password">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Password

**Password** As `Boolean</api/data_types/boolean>`

Indicates if this is is a password, which means the text is obscured as it is entered.

Activate password entry mode for the text field:

``` xojo
PasswordField.Password = True
```

<div id="iostextfield.placeholder">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.PlaceHolder

**PlaceHolder** As `Text</api/deprecated/text>`

The placeholder text that appears when the field is empty.

Placeholders are not the actual text so they do not need to be cleared before typing. Placeholders are useful for smaller screens because they can replace having a separate label to describe what to enter in the field.

Set the placeholder text:

``` xojo
NameField.PlaceHolder = "Enter your name"
```

<div id="iostextfield.text">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Text

**Text** As `Text</api/deprecated/text>`

The text in the field.

Sets the text in the field:

``` xojo
TextField1.Text = "Hello, World!"
```

Gets the text from the field:

``` xojo
Var desc As Text
desc = TextField1.Text
```

<div id="iostextfield.textalignment">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.TextAlignment

**TextAlignment** As iOSTextAlignment

The alignment for the text.

Center-align the text:

``` xojo
TextField1.TextAlignment = iOSTextAlignment.Center
```

<div id="iostextfield.textcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.TextColor

**TextColor** As `Color</api/data_types/color>`

The color of the text.

Change the text color to red:

``` xojo
TextField1.TextColor = Color.Red
```

<div id="iostextfield.textfont">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.TextFont

**TextFont** As `iOSFont</api/deprecated/iosfont>`

The font used to display the text.

Use the bold system font:

``` xojo
TextField1.TextFont = iOSFont.BoldSystemFont
```

<div id="iostextfield.top">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Top

**Top** As `Double</api/data_types/double>`

The top position of the control.

This property is read-only.

<div id="iostextfield.visible">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Visible

**Visible** As `Boolean</api/data_types/boolean>`

Indicates whether the control is visible.

Make a button invisible:

``` xojo
Button1.Visible = False
```

<div id="iostextfield.width">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Width

**Width** As `Double</api/data_types/double>`

The width of the control.

This property is read-only.

## Method descriptions

<div id="iostextfield.addconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.AddConstraint

**AddConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Adds a constraint to the control. This constraint is used by child controls that have been added to this control.

<div id="iostextfield.addcontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.AddControl

**AddControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Adds a child control to the control.

<div id="iostextfield.control">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Control

**Control**(index As `Integer</api/data_types/integer>`) As `MobileControl</api/user_interface/mobile/mobilecontrol>`

Gets the child control at the specified index.

<div id="iostextfield.controlcount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.ControlCount

**ControlCount** As `Integer</api/data_types/integer>`

The number of child controls in the control.

<div id="iostextfield.handle">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Handle

**Handle** As `Ptr</api/data_types/additional_types/ptr>`

The handle is used to get a reference to the control for interfacing directly with the iOS API.

<div id="iostextfield.invalidate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Invalidate

**Invalidate**

Marks the control so that it will be redrawn during the next event loop.

Call Invalidate to force a Canvas to redraw itself:

``` xojo
Canvas1.Invalidate
```

<div id="iostextfield.removeconstraint">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.RemoveConstraint

**RemoveConstraint**(constraint As `iOSLayoutConstraint</api/ios/ioslayoutconstraint>`)

Removes a constraint from the control.

<div id="iostextfield.removecontrol">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.RemoveControl

**RemoveControl**(child As `MobileControl</api/user_interface/mobile/mobilecontrol>`)

Removes the control from the control.

<div id="iostextfield.settintcolor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.SetTintColor

**SetTintColor**(value As `Color</api/data_types/color>`)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an <span class="title-ref">iOSTextField</span> this changes the cursor color.

## Event descriptions

<div id="iostextfield.close">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Close

**Close**

Called when the control is removed from its container, such as a view.

<div id="iostextfield.open">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.Open

**Open**

Called after the control is created. This is where you typically put initialization code.

Set label text in Open event:

``` xojo
Me.Text = "Hello"
```

<div id="iostextfield.textchange">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

iOSTextField.TextChange

**TextChange**

Called when the text changes from user entry. It is not called when the text is changed via code.

Update a label with the text as it is being entered:

``` xojo
NameLabel.Text = Me.Text
```

## Compatibility

iOS projects on the iOS operating system.

## See also

`MobileControl</api/user_interface/mobile/mobilecontrol>` parent class; `MobileTextArea</api/user_interface/mobile/mobiletextarea>` control
