Class

iOSSegmentedControl


Warning

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

Description

A horizontal button made up of multiple, independent segments.

Events

Name

Parameters

Returns

Close

Open

ValueChanged

Property descriptions


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

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

iOSSegmentedControl.Enabled

Enabled As Boolean

Indicates if the SegmentedControl is enabled for use.


iOSSegmentedControl.Height

Height As Double

The height of the control.

This property is read-only.


iOSSegmentedControl.Left

Left As Double

The left position of the control.

This property is read-only.


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


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


iOSSegmentedControl.Top

Top As Double

The top position of the control.

This property is read-only.


iOSSegmentedControl.Value

Value As Integer

The currently selected segment.


iOSSegmentedControl.Visible

Visible As Boolean

Indicates whether the control is visible.

Make a button invisible:

Button1.Visible = False

iOSSegmentedControl.Width

Width As Double

The width of the control.

This property is read-only.

Method descriptions


iOSSegmentedControl.Add

Add(item As MobileSegment)

Adds a segment to the end.

Add segments in the Open event:

Me.Add(New iOSSegmentedControlItem("Earth"))
Me.Add(New iOSSegmentedControlItem("Sun"))
Me.Add(New iOSSegmentedControlItem("Moon"))

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


iOSSegmentedControl.AddControl

AddControl(child As MobileControl)

Adds a child control to the control.


iOSSegmentedControl.Control

Control(index As Integer) As MobileControl

Gets the child control at the specified index.


iOSSegmentedControl.ControlCount

ControlCount As Integer

The number of child controls in the control.


iOSSegmentedControl.Count

Count As Integer

The number of segments.


iOSSegmentedControl.Handle

Handle As Ptr

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


iOSSegmentedControl.Insert

Insert(index As Integer, item As MobileSegment)

Inserts a segment at the specified index (0-based).

Add a segment at the beginning:

Var item As New iOSSegmentedControlItem("Moon")
SegmentedControl1.Insert(0, item)

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

iOSSegmentedControl.RemoveAll

RemoveAll

Removes all segments.

Remove all segments:

Me.SelectAll

iOSSegmentedControl.RemoveByIndex

RemoveByIndex(index As Integer)

Removes a specific segment by its index (0-based).

Remove the first segment:

SegmentedControl1.RemoveByIndex(0)

iOSSegmentedControl.RemoveByValue

RemoveByValue(item As MobileSegment)

Removes a specific segment.

Removes a specific segment:

' MoonSegment is a property of iOSSegmentedControlItem that
' was previously added to the segmented control.
SegmentedControl1.RemoveByValue(MoonSegment)

iOSSegmentedControl.RemoveConstraint

RemoveConstraint(constraint As iOSLayoutConstraint)

Removes a constraint from the control.


iOSSegmentedControl.RemoveControl

RemoveControl(child As MobileControl)

Removes the control from the control.


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


iOSSegmentedControl.Close

Close

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


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

iOSSegmentedControl.ValueChanged

ValueChanged

Called when the selected segment changes.

Compatibility

iOS projects on the iOS operating system.

See also

MobileControl parent class; MobileSegment class