iOS Switch
From Xojo Documentation
A Switch has an on/off position and is used to choose a preference. When the Switch is on, it appears with a green background.
Below are commonly used events and properties. Refer to iOSSwitch in the Language Reference for the complete list.
Events
- Called when the value for the Switch is changed, either by the user clicking on it or by code changing its Value property.
Properties
- A boolean that indicates if the switch is enabled and can be tapped or disabled and cannot be changed.
- A boolean that indicates the state of the Switch. When True, the Switch is on and displays with a green background. When False, the Switch is off.
Usage
To turn a switch on, set its value property:
MySwitch.Value = True
This code in the ValueChanged event handler enables or disables a Text Field depending on whether a Switch is on or off:
Example Projects
- Examples/iOS/Controls/SwitchExample
See Also
iOSSwitch class; UserGuide:iOS UI topic