Extends Item

Apple.Segmented

An iOS segmented control.

Apple.Segmented {
    Apple.Segmented.Segment {
        label: "Paid"
    }
    Apple.Segmented.Segment {
        label: "Free"
    }
    Apple.Segmented.Segment {
        label: "Top Grossing"
    }
}

Adding and removing segments

As shown above, each inline child Apple.Segmented.Segment automatically becomes a segment in the control.

To add and remove additional segments using code, call the Apple.Segmented.addSegment() and Apple.Segmented.removeSegment() methods.

A segment can only be added to one Apple.Segmented control. If you add a segment that is being used by another control, it will be removed from that control first.

property Int selected: 0

The currently selected segment.

property Color tint: #Apple.Tint

The segmented control's color.

Apple.Segmented {
    tint: #FEB619
}

property String font: "San Francisco"

property Float size: 13

Set the font and font size used by the segmented control.

property Array<Apple.Segmented.Segment> segmentsread only

The list of segments in this control.

function addSegment(Apple.Segmented.Segment segment)

function removeSegment(Apple.Segmented.Segment segment)

Add or remove a segment to the control.

A segment can only be added to one Apple.Segmented control. If you add a segment that is being used by another control, it will be removed from that control first.