Class

iOSTextField


Warning

This item was deprecated in version 2020r2. Please use MobileTextField as a replacement.

Description

A single-line text field for text.

Events

Name

Parameters

Returns

Close

Open

TextChange

Property descriptions


iOSTextField.AccessibilityHint

AccessibilityHint As Text

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

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

iOSTextField.AccessibilityLabel

AccessibilityLabel As Text

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

Me.AccessibilityLabel = "Calculate the value."

iOSTextField.Enabled

Enabled As Boolean

Indicates if the field is enabled or disabled.

Disable the text field

TextField1.Enabled = False

iOSTextField.Height

Height As Double

The height of the control.

This property is read-only.


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:

Me.KeyboardType = iOSKeyboardTypes.NumberPad

iOSTextField.Left

Left As Double

The left position of the control.

This property is read-only.


iOSTextField.Name

Name As 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.


iOSTextField.Parent

Parent As iOSControl

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

This property is read-only.


iOSTextField.Password

Password As 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:

PasswordField.Password = True

iOSTextField.PlaceHolder

PlaceHolder As 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:

NameField.PlaceHolder = "Enter your name"

iOSTextField.Text

Text As Text

The text in the field.

Sets the text in the field:

TextField1.Text = "Hello, World!"

Gets the text from the field:

Var desc As Text
desc = TextField1.Text

iOSTextField.TextAlignment

TextAlignment As iOSTextAlignment

The alignment for the text.

Center-align the text:

TextField1.TextAlignment = iOSTextAlignment.Center

iOSTextField.TextColor

TextColor As Color

The color of the text.

Change the text color to red:

TextField1.TextColor = Color.Red

iOSTextField.TextFont

TextFont As iOSFont

The font used to display the text.

Use the bold system font:

TextField1.TextFont = iOSFont.BoldSystemFont

iOSTextField.Top

Top As Double

The top position of the control.

This property is read-only.


iOSTextField.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSTextField.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSTextField.AddConstraint

AddConstraint(constraint As iOSLayoutConstraint)

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


iOSTextField.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSTextField.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSTextField.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSTextField.Handle

Handle As Ptr

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


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:

Canvas1.Invalidate

iOSTextField.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSTextField.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


iOSTextField.SetTintColor

SetTintColor(value As Color)

Changes a control's tint color. This varies by control and for some controls may not do anything. For example, with an iOSTextField this changes the cursor color.

Event descriptions


iOSTextField.Close

Close

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


iOSTextField.Open

Open

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

Set label text in Open event:

Me.Text = "Hello"

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:

NameLabel.Text = Me.Text

Compatibility

iOS projects on the iOS operating system.

See also

MobileControl parent class; MobileTextArea control