Class

iOSSwitch


Warning

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

Description

A Switch control is used to indicate an on/off, yes/no or true/false selection.

Events

Name

Parameters

Returns

Close

Open

ValueChanged

Property descriptions


iOSSwitch.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."

iOSSwitch.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."

iOSSwitch.Enabled

Enabled As Boolean

Enables or disables the switch.

Disable a Switch:

MySwitch.Enabled = False

iOSSwitch.Height

Height As Double

The height of the control.

This property is read-only.


iOSSwitch.Left

Left As Double

The left position of the control.

This property is read-only.


iOSSwitch.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.


iOSSwitch.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.


iOSSwitch.Top

Top As Double

The top position of the control.

This property is read-only.


iOSSwitch.Value

Value As Boolean

The value of the switch. On = True, Off = False.

If the Tax switch is on, then set the tax rate:

Var tax As Currency
If TaxSwitch.Value Then
  tax = 0.08
End If

iOSSwitch.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSSwitch.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSSwitch.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.


iOSSwitch.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSSwitch.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSSwitch.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSSwitch.Handle

Handle As Ptr

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


iOSSwitch.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

iOSSwitch.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSSwitch.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


iOSSwitch.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 MobileTextField this changes the cursor color.

Event descriptions


iOSSwitch.Close

Close

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


iOSSwitch.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"

iOSSwitch.ValueChanged

ValueChanged

Called when the value property is changed either by code or by the user.

Disable an iOSTextField when the switch is off and enable it when on:

If Me.Value Then
  MyTextField.Enabled = True
Else
  MyTextField.Enabled = False
End If

Compatibility

iOS projects on the iOS operating system.